problem on using JDBC interface

From: sam_ma(at)hksmartone(dot)com
To: pgsql-sql(at)postgresql(dot)org
Subject: problem on using JDBC interface
Date: 2000-04-19 07:37:43
Message-ID: H000046601e471f6@MHS
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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 Content-Type Size
BDY.TXT text/plain 937 bytes
WINMAIL.DAT application/ms-tnef 1015 bytes

Browse pgsql-sql by date

  From Date Subject
Next Message Manuel Lemos 2000-04-19 07:47:06 Re: Connecting website with SQL-database.....
Previous Message Tom Lane 2000-04-19 05:05:19 Re: Counting distinct names