| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.tools -> ORA-01401 : inserted value too large for column ?
Hello everybody,
I am working with Oracle and a Java program to put some midi audio files in a table but I have this problems :
I iterate throw a directory wich contains lots of midi files and I put
each files in the database...
But some of this files don't want to be put in the table and myy Java
program throw this exception "SQLException : ORA-01401 : inserted value
too large for column ".
The strange thing is that the files that throw this exception ARE NOT
the biggest one :( and moreover all my files are less than 1ko.
For the Java programmer, here is my code :
public class TestPutFiles {
private static Connection con;
public static void main(String args[]){
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
String url = "jdbc:oracle:thin:@myhost:1521:MYBASE";
con = DriverManager.getConnection(url, "user", "password");
/* The table has been created like this
"CREATE TABLE Test_Blob (id VARCHAR(20) PRIMARY KEY, data
LONG RAW) ");
*/
File myDir = new File("d:/devel/mid/");
System.out.println("Beginning of the iteration");
iterateThrowDir(myDir);
con.close();
} catch (Exception e) {
e.printStackTrace();
}
private static void iterateThrowDir(File theDir) {
File [] myList = theDir.listFiles();
for (int i = 0; i < myList.length; i++) {
String myName = myList[i].getName();
System.out.println(myName);
File myFile = myList[i];
long myFileLength = myFile.length();
if (myFile.isDirectory()) {
System.out.println("DIR > "+myName);
iterateThrowDir(myFile);
} else {
PreparedStatement stmt = null;
try {
InputStream myFis = new
java.io.FileInputStream(myFile);
stmt = con.prepareStatement("INSERT INTO Test_Blob
(id, data) VALUES (?,?)");
stmt.setString(1,myName);
stmt.setBinaryStream(2, myFis, (new
Long(myFileLength)).intValue());
stmt.executeUpdate();
System.out.println(" Insertion du fichier :
"+myName);
stmt.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
I try with the weblogic driver but it is the same problem, and with BLOB but also the same problem :(
Thanks for help
Franck Received on Thu Aug 09 2001 - 08:53:39 CDT
![]() |
![]() |