一种不使用数据源用Java直接连接数据源的方法
import java.sql.*;
public class Access{
public static void main(String args[]) throws Exception{
String strurl="jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ=D:\\projects\\demo.mdb";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn=DriverManager.getConnection(strurl) ;
Statement stmt=conn.createStatement();
ResultSet rs=stmt.executeQuery("select * from mcp_swty_player");
while(rs.next())
System.out.println(rs.getString("player_mobile"));
rs.close();
stmt.close();
conn.close();
}
}