Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix No suitable driver found for jdbc:sybase #247

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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.

@@ -218,7 +218,7 @@ def _jdbc_connect_jpype(jclassname, url, driver_args, jars, libs):
def _java_array_byte(data):
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