这是抛出来的异常 求大神救命。。!
java.sql.SQLException: 无效的列类型
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
at oracle.jdbc.driver.OracleStatement.get_internal_type(OracleStatement.java:6164)
at oracle.jdbc.driver.OraclePreparedStatement.setNull(OraclePreparedStatement.java:1316)
at oracle.jdbc.driver.OraclePreparedStatement.setObject(OraclePreparedStatement.java:2746)
at oracle.jdbc.driver.OraclePreparedStatement.setObject(OraclePreparedStatement.java:3015)
at com.netctoss.test.AccountDAOImpl.addAccount(AccountDAOImpl.java:250)
at com.netctoss.test.AccountDAOImpl.main(AccountDAOImpl.java:128)
这是抛出异常的代码片段。
public void addAccount(Account a)
throws DAOException, SQLException {
if(a == null)
return;
String sql = "insert into ACCOUNT " +
"values(account_seq1.nextval,?,?,?,'0',SYSDATE,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
Connection con =
DButil.getConnection();
try {
PreparedStatement ps =
con.prepareStatement(sql);
int index = 1;
//Integer 类型
ps.setObject(index++, a.getRecommenderId());
ps.setObject(index++, a.getLoginName());
ps.setObject(index++, a.getLoginPassword());
//这里用setObject不行用setDate也不行,setDate 的字段java里面是
//sql.date 类型,其余都是string类型
ps.setDate(index++, a.getPauseDate());
ps.setDate(index++, a.getCloseDate());
ps.setObject(index++, a.getRealName());
ps.setObject(index++, a.getIdcardNo());
ps.setDate(index++, a.getBirthdate());
ps.setObject(index++, a.getGender());
ps.setObject(index++, a.getOccupation());
ps.setObject(index++, a.getTelephone());
ps.setObject(index++, a.getEmail());
ps.setObject(index++, a.getMailaddress());
ps.setObject(index++, a.getZipcode());
ps.setObject(index++, a.getQq());
//java中都是Date sql 的类型
ps.setDate(index++, a.getLastLoginTime());
ps.setObject(index++, a.getLastLoginIp());
ps.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
throw new DAOException(
"新增账务账号失败!", e);
} finally {
DButil.Close();
}
}
为什么
OclassName=oracle.jdbc.driver.OracleDriver
Ourl=jdbc:oracle:thin:localhost:1521:orcl?connectionProperties=useUnicode=true;characterEncoding=utf-8
Ousername=system
Opwd=a19900826 这是我数据库驱动配置文件
OclassName=oracle.jdbc.driver.OracleDriver
Ourl=jdbc:oracle:thin:localhost:1521:orcl
Ousername=system
Opwd=a19900826
两个都不行,要疯了。 什么原因 怎么解决求大神帮帮忙 跪求。