Trouble Connecting to Database

I had just discovered how to get data from Hacker News via their API. My python program could grab all kinds of info that came in the form of JSON. There was a ton of data available. I would be pulling a thousand posts from there. What was I going to do with this data?

Figured I might as well stash it in a database of my own to play around with. I have a local Oracle 12 database running on my computer. Why not store the data there? There is a handy cx_Oracle module that is supposed to make it easy to connect to an Oracle database and save data.

For quite some time, I could not get my python program to connect to my Oracle database. At first my problem was that I specify which database using an Oracle SID. But the connection from cx_Oracle wanted a DSN. Luckily I found that cx_Oracle has a makedsn() function which will convert my SID to a DSN.

Still had problems making a connection to Oracle. All right. It was time to trap the DatabaseError exception provided by cx_Oracle. The error was quite explicit. It said there was a mismatch between my python and Oracle. One was 32-bit, and the other was 64-bit. After upgrading my python install to 64-bit to match Oracle, I was off to the races.

Popular posts from this blog

HTML Web Page Builder

Memories of Logo

Mission Accepted