package Test;
import java.sql.*;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2006</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class TestConnect {
public TestConnect() {
}
static Connection con = null;
public static void main(String args[]) {
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
//String url="jdbc:odbc:Driver={Microsoft Access Driver(*.mdb)};DBQ=D://demo.mdb";
String url="jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=D://demo.mdb";
//String url = "jdbc:odbc:Access";
con = DriverManager.getConnection(url,"","");
Statement stmt = con.createStatement();
String sql = "select * from base";
ResultSet rs = stmt.executeQuery(sql);
while (rs.next()) {
System.out.println("name= " + rs.getString(1));
}
rs.close();
stmt.close();
con.close();
//JakartaBasicDataSource.closeBasicDataSourceConnection();
}
catch (Exception e) {
e.printStackTrace();
System.out.println("now you have not ActiveConnection..........break!!");
}
}
}