baztian / jaydebeapi

JayDeBeApi module allows you to connect from Python code to databases using Java JDBC. It provides a Python DB-API v2.0 to that database.
GNU Lesser General Public License v3.0
365 stars 148 forks source link

Fix No suitable driver found for jdbc:sybase #247

Open leonarduk opened 4 months ago

leonarduk commented 4 months ago

I had to make this change to avoid No suitable driver found for jdbc:sybase.

Think after early versions of Java it looks like this is necessary

leonarduk commented 4 months ago

Was failing when using com.sybase.jdbc4.jdbc.SybDriver - got the exception "No suitable driver found for jdbc:sybase:Tds:..."

When testing the JDBC connection in Java, it worked when I created a new SybDriver() object, but failed if I did Class.forName("com.sybase.jdbc4.jdbc.SybDriver"), with the same error "No suitable driver found". This suggested I needed to create a SybDriver instance in the python code too.

When I took a local copy of jaydebeapi and made the suggested change, it worked.