Is there a way to query a netezza database without explicitly installing its driver? I am using ubuntu 64 bit OS, our IT support says the driver they have only works on red hat systems.
2 Answers
If you can get your hands on the JDBC driver, you could use the Python, jaydebeapi module, with the driver to connect to the server. Note that there are a couple quirks involved. Namely things like boolean datatypes.
6 Comments
Bo Qiang
Thanks. I got an error: jpype._jexception.NzSQLExceptionPyRaisable: org.netezza.error.NzSQLException: Connection refused. Check that the host name and port are cor rect and that the postmaster is accepting TCP/IP connections.
Bo Qiang
conn = jaydebeapi.connect("org.netezza.Driver", "jdbc:netezza://db_url:5480/db", ["usr","pass"], "./nzjdbc3.jar",)
joebeeson
@BoQiang -- Either you have the wrong host/port or there is not connectivity from your computer to the host/port. Resolve that issue and try again.
diman82
I get TypeError: Class org.netezza.Driver is not found
joebeeson
@diman82 please open an issue and provide the code you've used and the error you're encountering. Feel free to comment and I'll check it out.
|
You can use pyodbc.
pyodbc is an open source Python module that makes accessing ODBC databases simple. It implements the DB API 2.0 specification but is packed with even more Pythonic convenience.
On Ubuntu systems, all you need to do is run
sudo apt install unixodbc-dev
before attempting
pip install pyodbc
See more details from Installing pyodbc.
2 Comments
Bo Qiang
Thanks. In unixodbc.org, I did not find it contains a driver for Netezza. Do you have any examples for how to set it up? Thanks again.
McGrady
@BoQiang Have a look at the pyodbc doc.