sun.jdbc.odbc.JdbcOdbcDriver
import java.sql.Connection;
import java.sql.DriverManager;
public class Main {
public static void main(String[] args) throws Exception {
String url = "jdbc:odbc:yourDBName";
System.out.println("Attempting to connect to " + url);
try {
System.out.println("Loading the driver...");
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
System.out.println("Establishing a connection...");
Connection connection = DriverManager.getConnection(url);
System.out.println("Connect to " + connection.getCatalog() + " a success!");
} catch (Exception e) {
e.printStackTrace();
}
}
}
Related examples in the same category