数据库连接问题。
package 网吧计费系统;
import java.sql.*;
public class Data {
Connection con;
Statement st;
String sql;
public Data() {
}
public void openDate(){
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url = "jdbc:odbc:ts";
con = DriverManager.getConnection(url);
st = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
} catch (SQLException se) {
System.out.println(se);
} catch (ClassNotFoundException cnf) {
System.out.println(cnf);
}
}
public void search(){
openDate();
sql="";
ResultSet rs=st.executeQuery(sql);//这里有错
}
}
实在是不知道错在哪了,知道的大侠帮我一下,谢谢了