X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 59BD5528C7 for ; Fri, 10 Jun 2005 19:03:35 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 60251-04 for ; Fri, 10 Jun 2005 22:03:27 +0000 (GMT) Received: from mailsrv.ifxcorp.com (unknown [200.91.254.5]) by svr1.postgresql.org (Postfix) with ESMTP id 3F06052918 for ; Fri, 10 Jun 2005 19:03:26 -0300 (ADT) Received: from DEVELOPER06 ([10.16.120.171]) by mailsrv.ifxcorp.com with Microsoft SMTPSVC(5.0.2195.6713); Fri, 10 Jun 2005 18:03:27 -0400 From: =?iso-8859-1?Q?Andr=E9s_Luna?= To: Subject: Getting Reference cursors Date: Fri, 10 Jun 2005 17:03:26 -0500 Message-ID: <005501c56e08$3aeea800$ab78100a@ifx.local> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0056_01C56DDE.5218A000" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.2627 Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2742.200 X-OriginalArrivalTime: 10 Jun 2005 22:03:27.0839 (UTC) FILETIME=[3AFD26F0:01C56E08] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.659 tagged_above=0 required=5 tests=HTML_50_60, HTML_MESSAGE, HTML_TEXT_AFTER_BODY, HTML_TEXT_AFTER_HTML, UPPERCASE_25_50 X-Spam-Level: X-Archive-Number: 200506/51 X-Sequence-Number: 13013 This is a multi-part message in MIME format. ------=_NextPart_000_0056_01C56DDE.5218A000 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi guys =20 Im using the JDBC driver to connect to a Postgres Database. I have a function that returns a reference cursor and it works ok returning result itself. However, whenever I try to use the result set meta data of the ref cursor it doesn't work. Let me explain better: // procedure call CallableStatement proc =3D con.prepareCall("{ ? =3D call doquery ( ? ) = }"); proc.registerOutParameter(1, Types.Other); proc.setInt(2, -1); proc.execute(); ResultSet results =3D (ResultSet) proc.getObject(1); //this the ref. cursor ResultSetMetaData rm =3D results.getMetaData(); //result set meta data = of the ref. cursor System.out.println(rm); //prints the reference of the object so it is not null int columnCount =3D rm.getColumnCount() //NullPointerException :( results.close(); proc.close(); =20 The rm object in this code is not null. However, the internall data of it, such as column counts and column names is null. Am I doing something wrong ? Is it possible to obtain the result set meta data from a Reference cursor returned from an function. If not, how do you get the column names ??=20 =20 The driver version im using is : pg74.216.jdbc3.jar =20 Tks in advance for any help !! =20 =20 =20 ANDRES LUNA TAMAYO=20 Software Developer=20 IFX NETWORKS HYPERLINK "http://www.ifxnetworks.com/"www.ifxnetworks.com (571) 3693000 =20 ***** AVISO DE CONFIDENCIALIDAD ***** =20 ESTE MENSAJE, (INCLUYENDO CUALQUIER ANEXO) EST=C1 DIRIGIDO =DANICAMENTE = A LOS DESTINATARIOS ARRIBA SE=D1ALADOS. PUEDE CONTENER INFORMACI=D3N CONFIDENCIAL O PRIVILEGIADA Y NO DEBE SER LE=CDDO, COPIADO O DE OTRA = FORMA UTILIZADO POR CUALQUIER OTRA PERSONA. SI USTED RECIBE ESTA = COMUNICACI=D3N POR ERROR, FAVOR AVISAR AL REMITENTE Y ELIMINAR EL MENSAJE DE SU SISTEMA. =20 THIS E-MAIL (INCLUDING ANY ATTACHMENTS) IS INTENDED ONLY FOR THE RECIPIENT(S) NAMED ABOVE. IT MAY CONTAIN CONFIDENTIAL OR PRIVILEGED INFORMATION AND SHOULD NOT BE READ, COPIED OR OTHERWISE USED BY ANY OTHER PERSON. IF YOU ARE NOT A NAMED RECIPIENT, PLEASE CONTACT THE SENDER AND DELETE THE E-MAIL FROM YOUR SYSTEM. =20 =20 =20 --=20 No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.323 / Virus Database: 267.6.6 - Release Date: 08/06/2005 =20 ------=_NextPart_000_0056_01C56DDE.5218A000 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Mensaje
Hi=20 guys
 
Im = using the JDBC=20 driver to connect to a Postgres Database. I have a function that returns = a=20 reference cursor and it works ok returning result itself. However, = whenever I=20 try to use the result set meta data of the ref cursor it doesn't work. = Let me=20 explain better:
// =
procedure call
CallableStatement proc =3D con.prepareCall("{ ? =3D call doquery ( ? ) =
}");
proc.registerOutParameter(1, Types.Other);
proc.setInt(2, -1);
proc.execute();
ResultSet results =3D (ResultSet) =
proc.getObject(1); //this the ref. cursor
ResultSetMetaData rm =3D results.getMetaData(); =
//result set meta data of the ref. cursor
System.out.println(rm); =
//prints the reference of the object so it is not null
int columnCount =3D =
rm.getColumnCount() //NullPointerException :(
results.close();
proc.close();
 
The rm = object in=20 this code is not null. However, the internall data of it, such as column = counts=20 and column names is null. Am I doing something wrong ? Is it possible to = obtain=20 the result set meta data from a Reference cursor returned from an = function. If=20 not, how do you get the column names ??
 
The = driver version=20 im using is : pg74.216.jdbc3.jar
 
Tks in = advance for=20 any help !!
 
 
 
ANDRES LUNA = TAMAYO=20
Software Developer =
IFX NETWORKS
www.ifxnetworks.com
=
(571) = 3693000
 
***** AVISO DE = CONFIDENCIALIDAD=20 ***** 
ESTE MENSAJE, (INCLUYENDO CUALQUIER ANEXO) EST=C1 = DIRIGIDO=20 =DANICAMENTE A LOS DESTINATARIOS ARRIBA SE=D1ALADOS. PUEDE CONTENER = INFORMACI=D3N=20 CONFIDENCIAL O PRIVILEGIADA Y NO DEBE SER LE=CDDO, COPIADO O DE OTRA = FORMA=20 UTILIZADO POR CUALQUIER OTRA PERSONA. SI USTED RECIBE ESTA = COMUNICACI=D3N POR=20 ERROR, FAVOR AVISAR AL REMITENTE Y ELIMINAR EL MENSAJE DE SU=20 SISTEMA.
 
THIS E-MAIL (INCLUDING ANY = ATTACHMENTS) IS=20 INTENDED ONLY FOR THE RECIPIENT(S) NAMED ABOVE. IT MAY CONTAIN = CONFIDENTIAL OR=20 PRIVILEGED INFORMATION AND SHOULD NOT BE READ, COPIED OR OTHERWISE USED = BY ANY=20 OTHER PERSON. IF YOU ARE NOT A NAMED RECIPIENT, PLEASE CONTACT THE = SENDER AND=20 DELETE THE E-MAIL FROM YOUR SYSTEM. 
 
 

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.323 / Virus Database: 267.6.6 - Release Date: = 08/06/2005

------=_NextPart_000_0056_01C56DDE.5218A000--