pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: sam_ma@hksmartone.com
To: pgsql-sql@postgresql.org
Subject: problem on using JDBC interface
Date: Wed, 19 Apr 2000 15:37:43 +0800
Message-ID: <H000046601e471f6@MHS> (raw)

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

Attachments:

BDY.TXT (text/plain, 937B) download 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
WINMAIL.DAT (application/ms-tnef, 1015B) download

Message-ID: <H000046601e471f6@MHS>
Permalink:  ../H000046601e471f6@MHS/
Also on:    postgresql.org/message-id/H000046601e471f6@MHS

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: sam_ma@hksmartone.com
  Subject: Re: problem on using JDBC interface
  In-Reply-To: <H000046601e471f6@MHS>
  References: <H000046601e471f6@MHS>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox