I’m trying JDBC with a java program I’m trying to write, but my IDE is giving me some errors. I was wondering if someone could help me out. I added the SQL driver to the CLASSPATH and here is the code:
import java.io.*;
import java.sql.*;
public class Employee {
public int checkEmpID(int empID) throws SQLException, IOException {
int employeeID = empID;
int found = 0;
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn = DriverManager.getConnection("-","-","-");
String stmt1 = "select Enumber from Employee where Enumber = ?";
PreparedStatement p = conn.prepareStatement(stmt1);
p.clearParameters();
p.setInteger(1, employeeID);
ResultSet r = p.executeQuery();
while(r.next())
found = r.getInteger(1);
return found;
}
}
The errors I get are 2:
“cannot find symbol” “symbol: method setInteger(int,int) location: interface java.sql.PreparedStatement p.setInteger(1, employeeID);”
and
“cannot find symbol” “symbol: method getInteger(int) location: interface java.sql.ResultSet found = r.getInteger(1);”
The methods are setInt and getInt.