cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

No suitable driver found for jdbc:neo4j:bolt://localhost:7687

No suitable driver found for jdbc:neo4j:bolt://localhost:7687

I am trying to connect to Neo4j with Talend and I get the error in the subject line. I also get it when I try to connect with a console java application I wrote. Code below.
I am using a jar file I got from Download neo4j-jdbc JAR file with all dependencies
Is this the most relighable place to get the jar file from or is there a better jar file out there.

The java code on the console application compiles without error so the jar file is not corrupt.

/**

  • Sample connection to Neo4j using jdbc
  • compiled with command javac -cp "neo4j-jdbc-4.0.4.jar" ConnectToNeo4j.java
  • executed with command java ConnectToNeo4j
  • output

java.sql.SQLException: No suitable driver found for jdbc:neo4j:bolt://localhost:7687
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:706)
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:229)
at ConnectToNeo4j.main(ConnectToNeo4j.java:25)

**/
import java.net.URI;
import java.sql.*;

import org.neo4j.jdbc.*;
import org.neo4j.jdbc.Neo4jDriver;

class ConnectToNeo4j {
public static void main(String args) {
String query = "MATCH (n:User) RETURN n.name LIMIT 25";
try {
// My passsword isn't passsword !
Connection con = DriverManager.getConnection("jdbc:neo4j:bolt://localhost:7687", "neo4j", "password");
try (PreparedStatement stmt = con.prepareStatement(query)) {
try (ResultSet rs = stmt.executeQuery()) {
while (rs.next()) {
System.out.println("Found: "+rs.getString("u.name"));
}
} catch (Exception e) { e.printStackTrace(); }
} catch (Exception e) { e.printStackTrace(); }
con.close();
} catch (Exception e) { e.printStackTrace(); }
}
}

2 REPLIES 2

This has been partly resolved with an answer I got on StackOverflow java - Connection to Neo4j with jdbc No suitable driver found for jdbc:neo4j:bolt://localhost:7687 -...
What I needed was a driver from a different location.
I imported this into Talend and it worked but I still get the error on console app.

Java Write Once run on the exact JVM / JRE only!

https://repo1.maven.org/maven2/org/neo4j/neo4j-jdbc-driver/4.0.4/neo4j-jdbc-driver-4.0.4.jar

Java console commad to get this to run is

I had forgotten that Java needs to be told to even include the current directory in the classpath.

javac -cp "neo4j-jdbc-driver-4.0.4.jar" ConnectToNeo4j.java
java -classpath .;neo4j-jdbc-driver-4.0.4.jar ConnectToNeo4j