The Code is as follows: Class. forName (sun. jdbc. odbc. jdbcOdbcDriver); Stringstrurljdbc: odbc: driver {MicrosoftAccessDriver (*. mdb)}; DBQE: db. mdb; ConnectionconnDriverManager. getConnection (strurl); Statementstmtconn. createStatement (); ResultSetr
The Code is as follows: Class. forName (sun. jdbc. odbc. jdbcOdbcDriver); String strurl = jdbc: odbc: driver = {Microsoft Access Driver (*. mdb)}; DBQ = E: // db. mdb; Connection conn = DriverManager. getConnection (strurl); Statement stmt = conn. createStatement (); ResultSet r
The Code is as follows:
Class. forName ("sun. jdbc. odbc. JdbcOdbcDriver ");
String strurl = "jdbc: odbc: driver = {Microsoft Access Driver (*. mdb)}; DBQ = E: // db. mdb ";
Connection conn = DriverManager. getConnection (strurl );
Statement stmt = conn. createStatement ();
ResultSet rs1_stmt.exe cuteQuery ("select * from user ");
While (rs. next ())
{
Out. println (rs. getString ("user-name "));
}
Error: java. SQL. SQLException: [Microsoft] [ODBCDriverProgramManager] NotFoundDataSourceNameAndWeiSpecifyDefaultDriverProgram
Cause: there should be a space character between Driver and (*. mdb), and it can only be a blank character, that is
String strurl = "jdbc: odbc: driver = {Microsoft Access Driver (*. mdb)}; DBQ = E: // db. mdb"; should be
String strurl = "jdbc: odbc: driver = {Microsoft Access Driver (*. mdb)}; DBQ = E: // db. mdb ";