我正在尝试制作注册表单,在数据库(oracle)中注册用户但显示错误 -
cannot find symbol
symbol: method queryExecuter(String)
location: variable x of type DBConnect
----
cannot find symbol
symbol: method queryReturner(String)
location: variable x of type DBConnect
----
仅在RegisterUser.java文件中显示错误 代码 -
DBConnect.java -
import java.sql.*;
public class DBConnect {
Connection conn = null;
public DBConnect() throws Exception {
Class.forName("oracle.jdbc.OracleDriver");
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE", "system", "9424705385");
}
public void queryExecuter(String sql) throws Exception {
// for insert, update and Delete DML
Statement stat = conn.createStatement();
stat.execute(sql);
stat.close();
conn.close();
}
public ResultSet queryReturner(String sql) throws Exception { // select statement
Statement stat = conn.createStatement();
ResultSet rs = stat.executeQuery(sql);
return rs;
}
}
RegisterUser.java -
import java.sql.*;
public class RegisterUser {
public void insertUser(String email, String pass, String name, String mobile) throws Exception {
String sql = "insert into webreg value('" + email + "','" + pass + "','" + name + "','" + mobile + "')";
DBConnect x = new DBConnect();
x.queryExecuter(sql); // line showing error
}
public ResultSet getAllUser() throws Exception
{
DBConnect x = new DBConnect();
ResultSet rs = x.queryReturner("select * from webreg"); // line showing error
return rs;
}
}
我没有添加任何jar文件,除了ojdb6 jar,所以我必须添加任何jar文件吗?