connecting sybase by using DSN + SQLAnywhere

1.4k views Asked by At

I am connecting sybase by using DSN + SQLAnywhere.. But not able to find the driver. Please suggest me suitable Driver. Program:

Class.forName("com.sybase.jdbc4.jdbc.SybDriver"); Connection connection=DriverManager.getConnection("jdbc:SQLAnywhere:MYDB");

error Unable to get a connection from Sybase database No suitable driver found for jdbc:SQLAnywhere:SHRDB java.sql.SQLException:No suitable driver found for jdbc:SQLAnywhere:MYDB

1

There are 1 answers

0
thegnuu On

if you are using the sajdbc4.jar, try this:

try {
   Class.forName("sybase.jdbc4.sqlanywhere.IDriver");
   Connection con = DriverManager.getConnection("jdbc:sqlanywhere:dsn=*;uid=*;pwd=*");
} catch (ClassNotFoundException e) {
   e.printStackTrace();
} catch (SQLException e) {
   e.printStackTrace();
}

for older versions (SQLAnywhere 11) this driver should work: "sybase.jdbc.sqlanywhere.IDriver"