[JDBC] Problem while using result set

2001-08-20 Thread RaviShankar K



Hello,

 I am getting the following 
error sometimes, while using resultset.next() .
 (As the OS is Linux Japanese 
vesrion , there are some specialchars in the message.)

 An I/O error occured while 
reading from backend - Exception: java.net.SocketException: 
\??\??$B%r%L(B???$B!V%U(B?$B!#!&(B?: \??\??$B%r(B$B%L(B???$B!V%U(B?$B!#!&(B?Stack Trace:

java.net.SocketException: \??\??$B%r%L(B???$B!V%U(B?$B!#!&(B?: 
\??\??$B%r%L(B???$B!V%U(B?$B!#!&(B? at 
java.net.SocketInputStream.socketRead(Native 
Method) at 
java.net.SocketInputStream.read(SocketInputStream.java:86) 
at 
java.io.BufferedInputStream.fill(BufferedInputStream.java:186) 
at 
java.io.BufferedInputStream.read(BufferedInputStream.java:204) 
at 
org.postgresql.PG_Stream.ReceiveChar(PG_Stream.java:141) 
at 
org.postgresql.Connection.ExecSQL(Connection.java:396) 
at 
org.postgresql.jdbc2.Statement.execute(Statement.java:294) 
at 
org.postgresql.jdbc2.Statement.executeQuery(Statement.java:59) 
at 
org.postgresql.jdbc2.PreparedStatement.executeQuery(PreparedStatement.java:99) 
at 
java.util.TimerThread.mainLoop(Timer.java:435) 
at java.util.TimerThread.run(Timer.java:385)End of Stack Trace

 Please give me your 
inputs.

Regards,
Ravi


[JDBC] How to deal with oid field when it contains NULL ?

2001-08-09 Thread RaviShankar K



Hi,

 I am retrievingvalue of 
"oid" field using "getBlob(columnName)" method of ResultSet .
It is working fine if that field contains some 
"oid" reference . But if the field contains 
NULL , then it is throwing following error 
.

 "FastPath call returned 
ERROR: inv_open: large object 0 not found"

 I am able to solve the problem 
using the following way .
 
 ResultSet rs ;
 //If the value of reference is 
0 , then there is no Blob value in the row for the column 
"columnX".
 if(rs.getInt("columnX") != 
0){
  Blob 
someBlob = rs.getBlob("columnX");
 }

 Is there any better way than 
this ?
 Thanks in 
advance.

Regards,
Ravi




  

 



[JDBC] Retrieving field of type bigint[]

2001-08-09 Thread RaviShankar K

Hi René Pijlman,

Thank you for your mail. Sorry for the delayed reply .
I am giving the details about my application .

the CREATE TABLE statement used to create this particular
   table (or a description of the table from psql)
CREATE TABLE mytable (sno integer UNIQUE, image_ids bigint[]);

- some data from this table
The value of one of the row for the image_ids field :   {20, 40}

I tried to retrieve value of this field using getString(columnName)
method
of ResultSet and I was able to do it . I am able to insert the retrieved
string back in to the
database without any problem . So my problem is solved from my point of
view.

Is there anything wrong in what I did ? If it is , please tell me the
correct way.

Thanks  Regards,
Ravi




- Original Message -
From: Rene Pijlman [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Monday, August 06, 2001 PM 08:32
Subject: Re: [JDBC] Retrieving field of type bigint[]


Hello Ravi,

I'm sorry, but I'm not sure I understand what you are trying to
do.

I'd suggest that you post:
- the CREATE TABLE statement used to create this particular
table (or a description of the table from psql)
- some data from this table
- the actual Java/JDBC code that reproduces the error
- the full text of the error message in the exception.

Kind regards,
René Pijlman

My field type is bigint[] . I am storing some numbers in it (as an
array) .

I want to get that feild value and insert it into another table . When
I am using getLong() method ResultSet
I am getting error message Bad Long {1,2} . {1,2} is the value in that
field .

Please help me .My jdbc driver is jdbc7.1-1.3.jar.

Regards,
Ravi


---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly




---(end of broadcast)---
TIP 6: Have you searched our list archives?

http://www.postgresql.org/search.mpl



[JDBC] field of type oid

2001-08-06 Thread RaviShankar K



Hi ,

 I have 2 tables in my postgres 
DB .
 2 tables have a field 
"my_image"of type "oid" ( Blob) .

 I have to
  1.get a row 
from table A 
  
2.insertit intableB
  
3.deletethatfrom table A .

 Can I do like this 
?
ResultSet rs 
;
  
PreparedStatement pstmt;
  String qry2 
= "SELECT * FROM A";
  String qry 
= "INSERT INTO B (my_image) VALUES(?)";

  /*This part 
is doubtful to me */
 
pstmt.setInt(rs.getInt("my_image"));

 I am 
using rs.getInt() because I need only oid . It is working fine when I tested 
this code.
Iam able to insert integer in to field of 
type oid . I can retrieve image(Blob object)from table B using that 
inserted integer.

 However I don't know how much 
correct this way is . Please advice 
me.
 Thanks in 
advance.

Regards,
Ravi