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(); }
}
}