tvbas
03-24-2004, 10:01 AM
I use java to connect access db,the code appear like this:
String strurl="jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ=F:/tsefweb/jsp/db/students.mdb";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection(strurl) ;
Statement stmt=conn.createStatement();
ResultSet rs=stmt.executeQuery("select * from students where '1'='1'");
It is no problem,but
String strurl="jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ=F:/tsefweb/jsp/db/students.mdb";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection(strurl) ;
Statement stmt=conn.createStatement();
ResultSet rs=stmt.executeQuery("select * from students where \"1\"=\"1\"");
is wrong,though the sql sentence can correctly execute by copying to access.
String strurl="jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ=F:/tsefweb/jsp/db/students.mdb";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection(strurl) ;
Statement stmt=conn.createStatement();
ResultSet rs=stmt.executeQuery("select * from students where '1'='1'");
It is no problem,but
String strurl="jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ=F:/tsefweb/jsp/db/students.mdb";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection(strurl) ;
Statement stmt=conn.createStatement();
ResultSet rs=stmt.executeQuery("select * from students where \"1\"=\"1\"");
is wrong,though the sql sentence can correctly execute by copying to access.