getting field names from DB2 stored procedure

nag gan

getting field names from DB2 stored procedure
Hi,
We are testing DB2 stored procedures for UDB on NT.
I tested the example stored procedure in IBM site and tested on stored
procedure builder.
But when I called this SP from VB it is failing because the resultset is not
returning field names even though i specified in the select statement
"field1 AS FIELD1" instead it is passing sequence number.
Can anybody help me in this regard.
TIA
Pavan



_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com



Peter Van Eeuwen

Re: getting field names from DB2 stored procedure
(in response to nag gan)
It has been our experience that you WILL NOT get column names in the cursor(resultset).

We had a similiar issue and the solution was for the application, your case VB, in ours EJB, to access the columns by displacement order not column name.

If anyone has had success naming column names in a cursor; I too would be interested.

P. Van Eeuwen

On Wed, 03 January 2001, nag gan wrote:

>
> Hi,
> We are testing DB2 stored procedures for UDB on NT.
> I tested the example stored procedure in IBM site and tested on stored
> procedure builder.
> But when I called this SP from VB it is failing because the resultset is not
> returning field names even though i specified in the select statement
> "field1 AS FIELD1" instead it is passing sequence number.
> Can anybody help me in this regard.
> TIA
> Pavan
>
>
>
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com
>
>
>


Find the best deals on the web at AltaVista Shopping!
http://www.shopping.altavista.com



Andy Seuffert

Re: getting field names from DB2 stored procedure
(in response to Peter Van Eeuwen)




Andy [login to unmask email]
01/04/2001 01:19 PM

For DB2 UDB OS/390, in order to get back the column names for a Describe
SQLDA you must have the DESCSTAT paramater in DSNZPARM set to YES. Perhaps
UDB on NT has a similar feature.

From the DB2 UDB for OS/390 V6 Installation Guide 2.5.18:

13. DESCRIBE FOR STATIC

+------------------------------------------------------------------------+

Benjamin Reches

Re: getting field names from DB2 stored procedure
(in response to Andy Seuffert)
IN JDBC:

rs=stmt.getresultSet()
metaData=rs.getMetaData()
cols=metaData.getColumnCount()
for(i=1;i<=cols;i++)
String colName=metaData.getColumnName(i)
Object value=rs.getObject(i)

Ben

Peter Van Eeuwen wrote:

> It has been our experience that you WILL NOT get column names in the cursor(resultset).
>
> We had a similiar issue and the solution was for the application, your case VB, in ours EJB, to access the columns by displacement order not column name.
>
> If anyone has had success naming column names in a cursor; I too would be interested.
>
> P. Van Eeuwen
>
> On Wed, 03 January 2001, nag gan wrote:
>
> >
> > Hi,
> > We are testing DB2 stored procedures for UDB on NT.
> > I tested the example stored procedure in IBM site and tested on stored
> > procedure builder.
> > But when I called this SP from VB it is failing because the resultset is not
> > returning field names even though i specified in the select statement
> > "field1 AS FIELD1" instead it is passing sequence number.
> > Can anybody help me in this regard.
> > TIA
> > Pavan
> >
> >
> >
> > _________________________________________________________________
> > Get your FREE download of MSN Explorer at http://explorer.msn.com
> >
> >
> >
>
> Find the best deals on the web at AltaVista Shopping!
> http://www.shopping.altavista.com
>
>
>