BIGINT我想使用 JDBC 从 Oracle 数据库获取值。
getBigInt()或者getBigInteger()不起作用getInt()。
这是代码片段:
public List<Employee> getAllEmployees()
{
List<Employee> employeeList = new ArrayList<Employee>();
try
{
//typical jdbc coding
Connection conn = DBUtil.getConnection();
Statement st = conn.createStatement();
ResultSet rs = st.executeQuery("SELECT * FROM employee1");
while(rs.next())
{
Employee employee = new Employee(rs.getString("emp_id"), rs.getString("name"), rs.getBigInt("emp_mob"));
employeeList.add(employee);
}
DBUtil.closeConnection(conn); //close connection
}
catch(Exception e)
{
e.printStackTrace();
}
return employeeList;
}
Run Code Online (Sandbox Code Playgroud)
表中的 emp_mob 列包含大整数值。