Thread: problem on using JDBC interface

problem on using JDBC interface

From
sam_ma@hksmartone.com
Date:
Hi,

I have construct the java program for inserting binary data into
database but i get error message as "InputStream as parameter not
supported"

Java Program:

        String upstat = "insert into sent (Mess_size,Message,
validity_period, dnc, pid, msisdn,submission,oa) values
(?,?,?,?,?,?,0,?)";
        PreparedStatement pstmt = con.prepareStatement(upstat);
        File file = new File("sample.txt");

        FileInputStream fis = new FileInputStream(file);

        pstmt.setInt(1, message.length());
        pstmt.setBinaryStream(2, fis,(int)file.length());
        System.out.println("Update Result3 ");
        pstmt.setInt(3, validity_period);
        pstmt.setInt(4, dnc);
        pstmt.setInt(5, pid);
        pstmt.setString(6, msisdn);
        pstmt.setString(7, oa);
        pstmt.executeUpdate();
        pstmt.close();

Can someone to tell me the reason and solution for this error message?

rgds

Sam Ma
Attachment