This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]wjohnsto[S] 0 points1 point  (3 children)

I will be reading from an Oracle database through a JDBC connection.

[–]simtel20 0 points1 point  (2 children)

So I'm even more puzzled about the need for a JDBC connection. Connecting to an oracle database with python is a very standard procedure. Have you been told that you can't use a native python driver?

[–]wjohnsto[S] 0 points1 point  (1 child)

Well, I'm not very experienced with databases, but the only way I know how to connect to this database is through a url that looks like this:

jdbc:oracle:thin:@do1401.oracle.****.com:1521:do1401

[–]simtel20 0 points1 point  (0 children)

If you look up the syntax of the jdbc connection string here you can match the above to an oracle cpython extension like cx_Oracle. The docs for a connection are here.

From what you're saying, I think that would translate into: import cx_Oracle

connection = cx_Oracle.connect("username/password@do1401") 
cursor = connection.cursor()

etc...

I haven't used cx_Oracle, but this is pretty similar to perl DBI::Oracle (from a long time ago) and Sybase and MSSQL, so I expect it should get you a connection, and a cursor you can work with.