public static void main(String[] args) {
// TODO Auto-generated method stub
Connection con = ConnUtil.getConnection();
try {
PreparedStatement ps =con.prepareStatement("insert into image values (image_seq.nextval,?)");
FileInputStream in = new FileInputStream("f:\\line.gif");
ps.setBinaryStream(1,in,in.available());
int i = ps.executeUpdate();
if(i>0){
System.out.println("插入成功");
}else{
System.out.println("插入失败");
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
数据库连接成功
java.sql.SQLException: ORA-01460: 转换请求无法实施或不合理
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:573)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1891)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1093)
at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2047)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1940)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2709)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:589)
at DataTest.main(DataTest.java:21)
如何解决呢? |