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

Received issue; j2net.runtime could not be found #10

Closed imkhairulikhwan closed 2 years ago

imkhairulikhwan commented 2 years ago

Hi! I tried to integrate JDBC.NET to my .NET Core 6 application. However, after following the steps in Getting Started, I ran the sample codes and after hitting connection.Open(), I received the above error.

The full message would be "j2net.runtime could not be found. please check if the runtime is installed for your platform."

I have double-checked in the config as well and it seems fine.

Worth to take note is I upgraded the version from .NET Core 2.1 to 6 prior to integrating the code.

Thank you!

imkhairulikhwan commented 2 years ago

I noticed the issues always happens when I create .NET Core Web API project, but this issue didn't happen in console application

iodes commented 2 years ago

Originally, installing the J2NET Runtime Nuget package installs the Java runtime in the same path as the executable. However, the Web Core API approach doesn't seem to properly read the relative path to the Java runtime.

We will check the issue. Thanks you!

imkhairulikhwan commented 2 years ago

Noted on that, thank you!

May I know if there's a workaround for this? Is it possible to copy the Java runtime manually to the same path as executable?

iodes commented 2 years ago

That's right. The logic to find the Java Runtime path is here.

First, check the execution path while running the Web API. Then copy the contents of J2NET's "runtimes" folder to that execution path and it should work.

imkhairulikhwan commented 2 years ago

Thank you! We managed to execute connection.Open() method now after did the above steps. But, it seems we need to copy the .dll files as well apart from "runtimes" folder else it didn't work:

image

18682788952 commented 1 year ago

谢谢你!完成上述步骤后,我们现在设法执行了 connection.Open() 方法。但是,除了“运行时”文件夹之外,我们似乎还需要复制 .dll 文件,否则它不起作用:

图片

I also encountered the same problem. I am grateful if you can provide a solution