I am getting an exception:
java.sql.SQLException: No suitable driver found for com.timesten.jdbc.TimesTenDriver while trying to connect to Timesten DB installed in my system.
The code is given below:
Connection conn = null;
try {
Class.forName("com.timesten.jdbc.TimesTenDriver");
conn = DriverManager
.getConnection("com.timesten.jdbc.TimesTenDriver");
System.out.println(conn);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
finally {
try {
if(conn != null) {
conn.close();
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
I am using Java 5 & have attached ttjdbc5.jar in the build path of eclipse.
Can somebody help?
DriverManager.getConnection("com.timesten.jdbc.TimesTenDriver")
cannot have class name as parameter, instead should have url of the DB as parameter, something like
DriverManager.getConnection("jdbc:timedb://localhost");
or you can use
DriverManager.getConnection("jdbc:timedb://localhost:3601", "db-username", "db-password");
to get connection, where db-username
and db-password
are username/password to connect to DB server
Ensure the appropriate .jar
file is kept in your library and in DriverManager.getConnection()
remove the driver class name as parameter and pass the appropriate URL
for your database. for example if your database is SQLServer, then
DriverManager.getConnection("jdbc:sqlserver://10.3.12.59:1433,<optional parameters>","userName","Password");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.