java - Not able to connect with Sybase database -
in java trying connect sybase database through java program shown below
public static void connect() { sybdriver sybdriver = null; connection conn; try { sybdriver = (sybdriver) class.forname( // "com.sybase.jdbc3.jdbc.sybdriver").newinstance(); "com.sybase.jdbc2.jdbc.sybdriver").newinstance(); system.out.println("driver loaded"); conn = drivermanager.getconnection(url, username, password); boolean istrue = conn.isvalid(3); system.out.println(istrue);
but getting below exception
driver loaded
exception in thread "main" java.lang.abstractmethoderror: com.sybase.jdbc2.jdbc.sybconnection.isvalid(i)z @ connectiontry.connect(connectiontry.java:97) @ connectiontry.main(connectiontry.java:23)
i have done analysis in google have came know jconnn.jar missing issue method isvalid(i)z not there in jconn2.jar not there please advise how overcome error please.
the driver using - based on class name in stacktrace - jdbc 2 driver. isvalid
method added in java 6 (or: jdbc 4), can't use driver doesn't implement it.
you either need upgrade newer driver: contact sybase that, or not call isvalid
method. in code show there no reason call it: created connection, of course valid. method intended check validity of long-living connections (eg in context of connection pool).
Comments
Post a Comment