[JDBC] Inserting text and binaries in OID column

2001-08-08 Thread Esteban Chiner Sanz

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: 667570713Fax: +34 93 3711968
 Email:  [EMAIL PROTECTED]
---



---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html



Re: [JDBC] Inserting text and binaries in OID column

2001-08-08 Thread raviG

add this jar file in %TOMCAT_HOME%/lib dir.
or you can create a dir lib under .../webapps/serade/WEB-INF/lib/ and keep
this jar file in that dir if tomcat ver is 3.2.1 or later
restart the tomcat.

jar files cannot be opened with winzip.
try at the cmd line from the jar file dir 'jar tf jdbc7.1-1.2.jar' . it
lists all the class files in the jar
if doesnot list, then the downloaded file is corrupted..

I downloaded the jar from same site, it works fine for Blob.

regards
ravi.gunda
Senior Member Technical
Eximsoft Technologies Pvt Ltd,
Bangalore-560073

- Original Message -
From: Esteban Chiner Sanz [EMAIL PROTECTED]
To: raviG [EMAIL PROTECTED]
Sent: Wednesday, August 08, 2001 5:19 PM
Subject: Re: [JDBC] Inserting text and binaries in OID column


 Thank for your help but I have just downloaded del jdbc7.1-1.2.jar and
it's
 corrupted. When I restart tomcat I get this message: can not load the
 servlet: jsp:

/usr/local/WWW/jakarta/dist/tomcat/webapps/serade/WEB-INF/lib/jdbc7.1-1.2.ja
r
 is not a directory or zip/jar file or if it's a zip/jar file then it is
 corrupted. And if try to open it with WinZip a get a similar error.
 Do you have a clean copy of the driver? Where else could I get it from?
 Thank you,

 Esteban

 raviG wrote:

  Hi,
I think the problem is with old JDBC driver, get the latest from from
  http://jdbc.fastcrypt.com
 
  regards
  ravi.gunda
 
  Senior Member Technical
  Eximsoft Technologies Pvt Ltd,
  Bangalore-560073
 
  - Original Message -
  From: Esteban Chiner Sanz [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Wednesday, August 08, 2001 3:38 PM
  Subject: [JDBC] Inserting text and binaries in OID column
 
   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: 667570713Fax: +34 93 3711968
Email:  [EMAIL PROTECTED]
   ---
  
  
  
   ---(end of
broadcast)---
   TIP 5: Have you checked our extensive FAQ?
  
   http://www.postgresql.org/users-lounge/docs/faq.html

 --
 ---
  Esteban Chiner Sanz
  PlazaSite S.A.  c/ Tomás Bretón 32-38
  08950 Esplugues de Llobregat(Barcelona),SPAIN
  Ph: 667570713Fax: +34 93 3711968
  Email:  [EMAIL PROTECTED]
 ---



---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send unregister YourEmailAddressHere to [EMAIL PROTECTED])