nebula-contrib / nebula-jdbc

The JDBC connector for Nebula Graph.
41 stars 15 forks source link

Driver doesn't support STANDARD JDBC url #27

Closed corradomio closed 1 year ago

corradomio commented 2 years ago

After the class registration inside the JDBC DriverManager, it is not possible to use a ""standard JDBC url"" as:

DriverManager.getConnection("jdbc:nebula://host:port/graphSpace", ...)

In the attached file there is the minimum changes necessary to support this syntax NebulaDriver-java.txt

The FIRST problem IS NOT that it is possible to instantiate a "NebulaDriver" with the list of "ip:port" to use BUT that the driver can be used by a 3rd-part tool (for example in Aqua Data Studio) that uses the STANDARD behavior of a JDBC driver. The SECOND problem is that the nebula-graph database NOT NECESSARY is installed in the same machine (this means that IT IS NOT POSSIBLE to use "127.0.0.1"), BUT it can be installed in an another machine located in the network (with an another IP:PORT).

Young-Flash commented 2 years ago

nebula-jdbc is encapsulated based on nebula-java, due to the initialization of NebulaPool and JDBC driver loading sequence, the "standard JDBC url" form you mentioned above is not supported (see here). We will give more thoughts on this. You can use nebula-jdbc as Usage showed, make a Properties to store all settings you need and instantiate NebulaDriver with it.

corradomio commented 2 years ago

The "Usage" described the case where there is a total control con the code. But, as specified previously, it is not possible to change how a 3rd-part tool uses the driver.

It is necessary to be able to pass all configuration parameters using the url. This is very simple: the DriverPool must be created only on the connection creation, after the parsing of the url, not before.

The previous code already implements this: at the moment this is only a trick (I needed it very quickly).

For a "distribution ready" version, it is necessary to implement all features (multiple ip&ports, pool's configuration parameters, etc ...), AND multiple connections to different databases located at different url. To support this is simple: you have to create, at minimum, a DriverPool for each url, and the Connection object must refer to the correct pool.

On Sat, Apr 9, 2022 at 7:31 AM Young-Flash @.***> wrote:

nebula-jdbc is encapsulated based on nebula-java https://github.com/vesoft-inc/nebula-java, due to the initialization of NebulaPool and JDBC driver loading sequence, the "standard JDBC url" form you mentioned above is not supported (see here https://github.com/nebula-contrib/nebula-jdbc#3-q--a). We will give more thoughts on this. You can use nebula-jdbc as Usage https://github.com/nebula-contrib/nebula-jdbc#2-usage showed, make a Properties to store all settings you need and instantiate NebulaDriver with it.

— Reply to this email directly, view it on GitHub https://github.com/nebula-contrib/nebula-jdbc/issues/27#issuecomment-1093640544, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFUJJIAA5MGJMVU4654NYYLVED2X7ANCNFSM5S4ZPJJQ . You are receiving this because you authored the thread.Message ID: @.***>

xiajingchun commented 2 years ago

I totally agree with corradomio. Using a 3rd party tool to connect to NebulaGraph by jdbc is not possible now. Could you give it a priority? Thanks.

wey-gu commented 2 years ago

I had created a PR for better collaboration on this, now it's exactly the change proposed by @corradomio .

Nicole00 commented 1 year ago

resolved it in https://github.com/nebula-contrib/nebula-jdbc/pull/38