chequer-io / JDBC.NET

It is a wrapper that allows you to use JDBC drivers in ADO.NET
MIT License
33 stars 11 forks source link

JdbcConnection.Open() throwing exception #1

Open diogosilva96 opened 3 years ago

diogosilva96 commented 3 years ago

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 commented 7 months ago

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