Putting data to database?HELP
Hello, can anybody help me. I'm trying to store a blob object in to SQL Server 2000 and i got java.lang.ArrayIndexOutOfBoundsException
on the line pstm.setBinaryStream(7,infile,infile.available());
THANKS !!!!
This is mainly my source:
Connection con = null;
PreparedStatement pstm = null;
try
{
Date dtDate = Date.valueOf(strDate);
con = getConnection();
con.setAutoCommit(false);
Blob blob = null;
pstm = con.prepareStatement("INSERT INTO Version(Id_Number, Description, Version_Size, Version_Number, Marked, Create_Date, The_File, File_Record_Number)values ('?','?','?',?,?,?,?,?)");
System.out.println("essi f na setning komin ofninn");
java.io.File file = new java.io.File("c:\\tmp\\files\\filein.doc");
FileInputStream infile = new FileInputStream (file);
pstm.setBinaryStream(7, infile,infile.available());
System.out.println("b in a str ma");
pstm.setString(1,strIdNo);
pstm.setString(2,strDescript);
pstm.setString(3,strSize);
pstm.setDouble(4,dVersionNo);
pstm.setInt(5,nMarked);
pstm.setDate(6,dtDate);
pstm.setInt(8, nFile);
pstm.execute();
con.commit();
return true;
}

