neo4j-contrib / neo4j-apoc-procedures

Awesome Procedures On Cypher for Neo4j - codenamed "apoc"                     If you like it, please ★ above ⇧            
https://neo4j.com/labs/apoc
Apache License 2.0
1.71k stars 493 forks source link

Unable to load MSSQL JDBC driver #1767

Closed romandogadin closed 3 years ago

romandogadin commented 3 years ago

Guidelines

Please note that GitHub issues are only meant for bug reports/feature requests. If you have questions on how to use APOC, please ask on the Neo4j Discussion Forum instead of creating an issue here.

Expected Behavior (Mandatory)

Expecting call apoc.load.driver("com.microsoft.sqlserver.jdbc.SQLServerDriver") to load the MSSQL driver with no errors

Actual Behavior (Mandatory)

Getting the error: Failed to invoke procedure apoc.load.driver: Caused by: java.lang.RuntimeException: Could not load driver class com.microsoft.sqlserver.jdbc.SQLServerDriver com.microsoft.sqlserver.jdbc.SQLServerDriver

How to Reproduce the Problem

Run: call apoc.load.driver("com.microsoft.sqlserver.jdbc.SQLServerDriver")

Simple Dataset (where it's possibile)

//Insert here a set of Cypher statements that helps us to reproduce the problem

Steps (Mandatory)

  1. Upload mssql-jdbc-8.4.1.jre8.jar driver into the plugins directory (also tried mssql-jdbc-8.4.1.jre11 and mssql-jdbc-8.4.1.jre14)
  2. Restarted the Desktop
  3. Started the database

    Screenshots (where it's possibile)

    Capture Capture Java

Specifications (Mandatory)

Neo4j DBMS: 4.1.3 Java: 11.0.9 Java SE 18.9

Versions

conker84 commented 3 years ago

@romandogadin can you just try to call the apoc.load.jdbc with the proper connection string and report back?

romandogadin commented 3 years ago

Hi @conker84 , thank you for your reply. Here is what I get when I try to connect: Failed to invoke procedure apoc.load.jdbc: Caused by: java.sql.SQLException: No suitable driver found for jdbc:sqlserver://XXXX

conker84 commented 3 years ago

@conker84 can you please use this version? https://github.com/neo4j-contrib/neo4j-apoc-procedures/releases/tag/4.1.0.4

romandogadin commented 3 years ago

@conker84 , this is the version I have been using all this time. I removed the apoc-4.3.0 file from the plugin directory you are seeing on the screenshot to avoid confusion. APOC

conker84 commented 3 years ago

mssql-jdbc-8.4.1.jre11.jar.zip Can you please try with the jar above? Please make sure to restart your database once you unzipped the file into the plugins directory

romandogadin commented 3 years ago

@conker84 I am getting the same error after I uploaded the jar in to the plugins directory. I did restart the database and the desktop prior to executing the command.

Failed to invoke procedure apoc.load.driver: Caused by: java.lang.RuntimeException: Could not load driver class com.microsoft.sqlserver.jdbc.SQLServerDriver com.microsoft.sqlserver.jdbc.SQLServerDriver

conker84 commented 3 years ago

image

Screenshot 2021-01-25 at 15 01 43

We successfully tried in both Mac and Windows env, so it's something related to your classpath. What is your Neo4j Desktop version?

romandogadin commented 3 years ago

Thanks for looking into it. My desktop version is 1.4.1. The OS is Win10. Is there anything particular I can do to troubleshoot the classpath issue. Should I enable any logs to get more details? Even if I delete everything from the plugins directory and try and execute the command I get the same error message. I was also able to install the APOC plugin without having the apoc library in the plugins dir. Is it possible it is pointed at another directory? Thanks

conker84 commented 3 years ago

please try to create a new database (and from the database stopped):

  1. install apoc
  2. import the JDBC driver jar that I shared above into the plugins dir
  3. Start Neo4j
  4. execute the apoc.load.driver call
romandogadin commented 3 years ago

Hi @conker84 , I have tried following your steps and still no luck - got the same error (DB v4.1.3; APOC 4.1.0.6). I have also tried creating a new db using the latest version 4.2.3 and APOC 4.2.0.1 - same error. It asks me to fix conflicts when I first start the db (attaching the screenshot). winex desktop conflicts driver error

conker84 commented 3 years ago

I think that you put the driver under a wrong directory because there is no APOC inside it. In order to be sure that you are inside the correct dir please look at the following image an click in this order:

  1. to the area highlighted in red
  2. to the area highlighted in yellow
  3. to area highlighted in blue

This will open the correct plugin directory and in there put the MSSQL jar, then restart the database

Screenshot 2021-01-28 at 16 49 15
romandogadin commented 3 years ago

@conker84 that was it! I had a feeling I wasn't using the right plugin directory. Thank you so much.