Skip to Content
1
Oct 04, 2016 at 04:53 AM

SYBASE CONNECTION WITH JAVA ERROR

1141 Views

i am trying to connect sybase with java with the following code :

try{

Class.forName("com.sybase.jdbc4.jdbc.SybDriver");

} catch (ClassNotFoundException cnfe){

System.out.println("Could not find the JDBC driver!");

System.exit(1);

}

Connection conn = null;

try {

conn = DriverManager.getConnection("jdbc:sybase:Tds:Host:Port#/DBNAME","UName","Pass");

System.out.println("Connection done");

} catch (SQLException sqle) {

sqle.printStackTrace();;

System.exit(1);

}

}

and i am getting this exeception :

java.sql.SQLException: JZ00L: Login failed. Examine the SQLWarnings chained to this exception for the reason(s).

at com.sybase.jdbc4.jdbc.SybConnection.getAllExceptions(Unknown Source)

at com.sybase.jdbc4.jdbc.SybConnection.handleSQLE(Unknown Source)

at com.sybase.jdbc4.jdbc.SybConnection.a(Unknown Source)

at com.sybase.jdbc4.jdbc.SybConnection.handleHAFailover(Unknown Source)

at com.sybase.jdbc4.jdbc.SybConnection.<init>(Unknown Source)

at com.sybase.jdbc4.jdbc.SybConnection.<init>(Unknown Source)

at com.sybase.jdbc4.jdbc.SybDriver.connect(Unknown Source)

at java.sql.DriverManager.getConnection(DriverManager.java:571)

at java.sql.DriverManager.getConnection(DriverManager.java:215)

at test.SybaseExample2.main(SybaseExample2.java:98)