Skip to content

Conversation

@leonarduk
Copy link

@leonarduk leonarduk commented Jul 3, 2024

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

…class

I had to make this change to work for my installation.  Think after early versions of Java it looks like this is necessary
@leonarduk
Copy link
Author

leonarduk commented Jul 3, 2024

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.

return jpype.JArray(jpype.JByte, 1)(data)
# register driver for DriverManager
jpype.JClass(jclassname)
jpype.JClass(jclassname)()
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this means instead of just loading the class, we create an instance. When I did this for SybDriver, it then registered the driver. Without the change, it didn't.

@leonarduk leonarduk changed the title Update __init__.py to initialise the driver rather than just get the … Fix No suitable driver found for jdbc:sybase Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant