当前位置: 技术问答>java相关
jsp+access 出错,
来源: 互联网 发布时间:2015-11-10
本文导语: import java.sql.*; public class DBconn { String DBDriver = "Microsoft Access Driver"; String ConnStr = "jdbc:odbc:hotel"; Connection conn = null; ResultSet rs = null; public DBconn { try { Class.forName(DBDriver); } catch(java.lang.ClassNotFoundExc...
import java.sql.*;
public class DBconn {
String DBDriver = "Microsoft Access Driver";
String ConnStr = "jdbc:odbc:hotel";
Connection conn = null;
ResultSet rs = null;
public DBconn {
try {
Class.forName(DBDriver);
}
catch(java.lang.ClassNotFoundException e) {
System.err.println("DBconn (): " + e.getMessage());
}
}
public ResultSet executeQuery(String sql) {
rs = null;
try {
conn = DriverManager.getConnection(ConnStr);
Statement stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
}
catch(SQLException ex) {
System.err.println("aq.executeQuery: " + ex.getMessage());
}
return rs;
};
}
用DOS查,第13和第53行处错??
public class DBconn {
String DBDriver = "Microsoft Access Driver";
String ConnStr = "jdbc:odbc:hotel";
Connection conn = null;
ResultSet rs = null;
public DBconn {
try {
Class.forName(DBDriver);
}
catch(java.lang.ClassNotFoundException e) {
System.err.println("DBconn (): " + e.getMessage());
}
}
public ResultSet executeQuery(String sql) {
rs = null;
try {
conn = DriverManager.getConnection(ConnStr);
Statement stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
}
catch(SQLException ex) {
System.err.println("aq.executeQuery: " + ex.getMessage());
}
return rs;
};
}
用DOS查,第13和第53行处错??
|
public DBconn {
是public class DBconn {
return rs;
}; //没有这个";"的
}
应该是
return rs;
}
}
是public class DBconn {
return rs;
}; //没有这个";"的
}
应该是
return rs;
}
}