PDA

View Full Version : " problem of access db,SOS!


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.

tvbas
03-30-2004, 02:51 AM
this (http://www.freewebs.com/kzhangmp3/AccessDb.rar) is my code.
java.sql.SQLException