BLOB
843859Apr 24 2007 — edited Nov 20 2014Hello,
I would like to insert a Blob into a oracle table. I'd like to do it without the empty_blob procedure.
I've been looking for a solution in Internet and I've found that a standard way is the next one:
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection connection = DriverManager.getConnection("jdbc:oracle:thin:@128.90.111.145:1521:producto10G", "PRUSOL","PRUSOL");
PreparedStatement stmt = connection.prepareStatement("INSERT INTO IVOLVOLTBL VALUES (?,?,?,?,?,?,?)");
File file = new File ("c:\\bbk.jpg");
FileInputStream fis = new FileInputStream (file);
stmt.setString(1, "AAAA");
stmt.setInt(2, 1111);
stmt.setInt(3, 1111);
stmt.setInt(4, 1111);
stmt.setInt(5, 1111);
stmt.setString(6, "617");
stmt.setBinaryStream(7, fis, (int)file.length());
stmt.execute();
connection.close();
fis.close();
But when I run the program, and the file size is bigger than a few kb, the next exception is thrown: ORA-01460: unimplemented or unreasonable conversion.
I'm ussing oracle drivers ojdbc14.jar.
What am I doing wrong?
Thanks in advanced !!