Hi All,
This is the code as of now.
public static void main(String[] args) {
//PrintWriter pw = response.getWriter();
String connectionURL = "jdbc:db2://172.16.31.33:60000/DB2TLOC";
StringBuffer query=null;
Statement stmt= null;
PreparedStatement pst = null;
java.sql.Connection connection=null;
FileInputStream fis;
try
{
Class.forName("com.ibm.db2.jcc.DB2Driver").newInst ance();
connection = DriverManager.getConnection(connectionURL,"PWD", "PWD");
query=new StringBuffer("INSERT INTO CPAD.SIGNMASTER150MT (UNAME,SCODE,SIGNATURE) VALUES(?,?,?)");
stmt=connection.createStatement();
pst=connection.prepareStatement(query.toString());
File file = new File("C:/Documents and Settings/cpad/My Documents/RBILOGO.bmp");
pst.setString(1, "1252");
pst.setString(2, "1242");
pst.setBinaryStream(3, new FileInputStream(file),(int)file.length());
System.out.println("Image");
pst.executeUpdate();
System.out.println("Image has been inserted");
}
catch (Exception e)
{
System.out.println(e);
}
}
But still I am unable to store the image. The following is the error:
DB2 SQL error: SQLCODE: -301, SQLSTATE: 42895, SQLERRMC: 1
Any suggestions ??