Inserting text and binaries in OID column

From: Esteban Chiner Sanz <echiner(at)plazasite(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Inserting text and binaries in OID column
Date: 2001-08-08 06:38:40
Message-ID: 3B70DE70.29770104@plazasite.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hello, I'm new in this list so I don't know if this question has been
asked before. If so, sorry.
The question is that I'm trying to insert text and/or binaries in an OID
column but I can't find the way to do it. I have tried to use the code
in the documentation (section "Using large objects") but I get this
message: "InputStream as parameter not supported".
Can someone please post some code here so I can see how it's done? Where
can I get the latest compiled JDBC driver?
Thank you very much,

Esteban Chiner

P.D: If it helps, this is the code I use:

try {
String texto = "Whatever";
pst = con.prepareStatement("INSERT INTO users VALUES (?,?)");
pst.setString(1,"user_name");
byte[] bytes = texto.getBytes();
InputStream is = new ByteArrayInputStream(bytes);
pst.setBinaryStream(2,is,texto.length());
pst.executeUpdate();
} catch (SQLException E) {
}
-------------------------------------------------------
Esteban Chiner Sanz
PlazaSite S.A. c/ Tomás Bretón 32-38
08950 Esplugues de Llobregat (Barcelona), SPAIN
Ph: 667570713 Fax: +34 93 3711968
Email: echiner(at)plazasite(dot)com
-------------------------------------------------------

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message raviG 2001-08-08 08:53:20 Re: Inserting text and binaries in OID column
Previous Message heatherm 2001-08-08 05:31:33 deleting large objects from jdbc