Set up a DSN and get a connection through that
November 15th, 2007
import java.sql.*;
public class Test
{
public static void main(String[] args)
{
// change this to whatever your DSN is
String dataSourceName = “mdbTEST”;
String dbURL = “jdbc:odbc:” + dataSourceName;
try {
Class.forName(”sun.jdbc.odbc.JdbcOdbcDriver”);
Connection con = DriverManager.getConnection(dbURL, “”,”");
}
catch (Exception err) {
System.out.println( “Error: ” + err );
}
}
}
//save this code into a file called Test.java and compile it
Leave a Reply