Reputation: 13666
Hi I am getting problem of not connecting to sybase database using jdbc. I have also put jconn.jar in dependency of intellij 12.1.
I am getting the following excpetion
java.sql.SQLException: No suitable driver found for jdbc:jtds:sybase:some.com:8000/DBAQ02 at java.sql.DriverManager.getConnection(DriverManager.java:604) at java.sql.DriverManager.getConnection(DriverManager.java:221) at gbconnect.DBConnectPOC.main(DBConnectPOC.java:81) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Please see the following code . Please guide I am really got mad. Thanks in advance.
try
{
Class.forName("com.sybase.jdbc3.jdbc.SybDriver");
}
catch (ClassNotFoundException e)
{
throw new IllegalArgumentException(
"Driver class '" + driverClassName + "' is not valid.", e);
}
}
//jdbc:jtds:sybase://some.com:8000/DBAQ02
Statement stmt = null;
Connection conn = null;
try
{
System.out.println(driverClassName + "://" + url);
conn = DriverManager.getConnection("jdbc:jtds:sybase:some.com:8000/DBAQ02","sa","abc");
stmt = conn.createStatement();
stmt.executeUpdate(SQL_CREATE);
System.out.println("Created table in given database...");
}
Upvotes: 1
Views: 18765
Reputation: 76
I know m way too late but came across this question just now. So, here are some things: Did you try: 1)jconn4.jar
2)Class.forName("com.sybase.jdbc4.jdbc.SybDriver");
3)DriverManager.getConnection("jdbc:sybase:Tds:some.com:8000?ServiceName=DBAQ02", "sa", "abc");
4)Are you sure the url is: some.com?
5)Instead of using some.com, why don't you put the actual IP address?
6)Are you sure 8000 is the port? Check it once.
Link source that helped: http://fm4dd.com/database/howto-install-Sybase-jdbc.htm
Upvotes: 6
Reputation: 6969
Please check your connection URL.
It should be jdbc:sybase:Tds:some.com:8000
for the driver you are loading.
Upvotes: 4