Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
05-23-2019 11:30 AM
Hi All,
Im trying to connect to neo4j using java using neo4j driver. The connectivity is successful when i try it from eclipse, but when i deploy the same class it its throwing error "No suitable driver found for jdbc:neo4j:bolt://localhost:port". The same jar is also present in the web application.
code Snippet:
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
Connection conn = DriverManager.getConnection("jdbc:neo4j:bolt://localhost:port") ;
System.out.println("Initiating the method");
long startTime = System.currentTimeMillis();
PreparedStatement stmt = conn.prepareStatement("MATCH (Actors:Actors) RETURN Actors.Name");
ResultSet rset = stmt.executeQuery();
long endTime = System.currentTimeMillis();
System.out.println("That took " + (endTime - startTime) + " milliseconds");
Requesting for inputs on the issue.
05-23-2019 12:08 PM
Make sure you have included the neo4j-jdbc-driver in your dependencies.
05-23-2019 12:14 PM
My Application is not a maven application. Its a java standalone application. I have included ```
neo4j-jdbc-driver:3.3.1 as thirdparty jar. Still its not working.
But if we use
Driver driver = GraphDatabase.driver(
URL, AuthTokens.basic( "neo4j", "password" ) );
Session session = driver.session();
its working. But we are seeing some performance issues with this. . The throughput is very low if we use GraphDatabse.driver since we are creating session explicitly and then querying. So wanted to use the other option to retrieve the data and check if its quick. My other application is working with oracle as the backend database. We are making the api call to neo4j for retrieving data for one of the functionalities.
05-23-2019 02:22 PM
Have you ever try using this parameters?
Connection con = DriverManager.getConnection("jdbc:neo4j:bolt://localhost", 'user', password);
Because you only provided the URL and Port
Connection conn = DriverManager.getConnection ("jdbc: neo4j: bolt: // localhost: port")
05-24-2019 07:55 AM
This started working now after i added the following piece of code.
Class.forName("org.neo4j.jdbc.Driver").newInstance();
All the sessions of the conference are now available online