The connecter( ) method
// A JDBCExamples method to get a connection.
// It can be called from the server with argument 'default',
// or from a client, with an argument that is the server name.
public static Connection connecter(String server)
throws Exception, SQLException, ClassNotFoundException {
String forName="";
String url="";
if (server=="default") { // server connection to current server
forName = "sybase.asejdbc.ASEDriver";
url = "jdbc:default:connection";
} else if (server!="default") { //client connection to server
forName= "com.sybase.jdbc.SybDriver";
url = "jdbc:sybase:Tds:"+ server;
}
String user = "sa";
String password = "";
// Load the driver
Class.forName(forName);
// Get a connection
Connection con = DriverManager.getConnection(url,
user, password);
return con;
}