I installed a local database and used SQL Developer to create a test table.
db connection works, also table is created and populated
example here
and running this example code in python gives me some errors
import oracledb
conn = False
try:
connection = oracledb.connect(dsn="localhost/xepdb1", port=1521, mode=oracledb.SYSDBA, user="sys", password="syspassword")
conn = True
print("connected") # <- this goes to console so it's not a connection issue
except:
print("failed")
if conn:
cursor = connection.cursor()
querry = "SELECT * FROM TEST"
r = cursor.execute(querry)
The error I am getting ORA-00942: table or view does not exist
now if i create tables in the code they actually work but that is not optimal for me since i have to create many tables and populate a lot of data. using the SQL Developer interface is so much better for me..
i tried using cx_Oracle package but I find it a bit more difficult to work with and also encounter the same issue while reading data
i tried to change the querry to 'SELECT SYS.TEST'
or 'SELECT SYSDBA.TEST'
and all the case sensitive alternatives
I tried running the selection from command line
sqlplus / as sysdba
SELECT * FROM TEST;
and it display my 2 rows of data
1 test1
2 test4
but python refuses to read the tables for some reason
it’s like oracledb is reading from a completely different database
sqlplus cmd is in sync with SQLDeveloper, but tables created in python are not readable on the other 2 either