Getting Reference cursors

From: Andrés Luna <aluna(at)ifxcorp(dot)com>
To: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Getting Reference cursors
Date: 2005-06-10 22:03:26
Message-ID: 005501c56e08$3aeea800$ab78100a@ifx.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hi guys

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 = con.prepareCall("{ ? = call doquery ( ? ) }");

proc.registerOutParameter(1, Types.Other);

proc.setInt(2, -1);

proc.execute();

ResultSet results = (ResultSet) proc.getObject(1); //this the ref.
cursor

ResultSetMetaData rm = 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 = rm.getColumnCount() //NullPointerException :(
results.close();

proc.close();

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 ??

The driver version im using is : pg74.216.jdbc3.jar

Tks in advance for any help !!



ANDRES LUNA TAMAYO
Software Developer
IFX NETWORKS
HYPERLINK "http://www.ifxnetworks.com/"www.ifxnetworks.com
(571) 3693000

***** AVISO DE CONFIDENCIALIDAD *****
ESTE MENSAJE, (INCLUYENDO CUALQUIER ANEXO) ESTÁ DIRIGIDO ÚNICAMENTE A
LOS DESTINATARIOS ARRIBA SEÑALADOS. PUEDE CONTENER INFORMACIÓN
CONFIDENCIAL O PRIVILEGIADA Y NO DEBE SER LEÍDO, COPIADO O DE OTRA FORMA
UTILIZADO POR CUALQUIER OTRA PERSONA. SI USTED RECIBE ESTA COMUNICACIÓN
POR ERROR, FAVOR AVISAR AL REMITENTE Y ELIMINAR EL MENSAJE DE SU
SISTEMA.

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.

--
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

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message hubert depesz lubaczewski 2005-06-11 06:18:57 duration: missing with jdbc for postgresql 8.0
Previous Message Valentin Randolph 2005-06-10 18:43:47 67% of members got laid