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

JdbcConnection.Open() throwing exception #1

Open
diogosilva96 opened this issue Feb 19, 2021 · 1 comment
Open

JdbcConnection.Open() throwing exception #1

diogosilva96 opened this issue Feb 19, 2021 · 1 comment

Comments

@diogosilva96
Copy link

diogosilva96 commented Feb 19, 2021

So I was trying to estabilish a Jdbc connection on .NET through this library. Whenever I try to load my Jdbc driver, the following error occurs: Grpc.Core.RpcException: 'Status(StatusCode=Internal, Detail="org/apache/log4j/Logger")'. This occurs when the JdbcConnection bridge is being created when calling JdbcConnection.Open(). You can find my code below:
var driverPath = $"{Path.GetDirectoryName(typeof(Program).Assembly.Location)}\\MyJdbcDriver.jar";
var builder = new JdbcConnectionStringBuilder { DriverPath = driverPath, DriverClass = "com.example.jdbc.MyDriver", JdbcUrl = "jdbc:MyDriver:HOST='localhost';PORT='8087';UID='admin;PWD='123';ACC='Admin'" };
var connection = new JdbcConnection(builder);
connection.Open();
var command = connection.CreateCommand("SELECT * FROM Users;");
var reader = command.ExecuteReader();

I ensured that the driver path contains the jdbc driver. I also tried this using ConnectionString property instead of the JdbcUrl and with relative or absolute paths of the jdbc driver, but didn't work either. I think this might have to do with how I setup my connection string or either the DriverPath/DriverClass is not setup correctly.

Note: I was able to estabilish this connection on Java, using this exact driver and connection string but no luck on .NET side with this library.

Any ideas why I might be getting this error?

Thanks.

@tcables
Copy link
Contributor

tcables commented Nov 28, 2023

JdbcUrl = "jdbc:MyDriver:HOST='localhost';PORT='8087';UID='admin;PWD='123';ACC='Admin'" };

If im reading that correctly, you are missing a single quote ( ' ) after UID='admin (;PWD=).

But as a future feature, it would also be nice to have the exception surfaced to .net, so we could see this immediately

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants