If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > how to get the headers of informix table?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-01-04, 13:59
amachou_doubaji amachou_doubaji is offline
Registered User
 
Join Date: Mar 2004
Posts: 10
how to get the headers of informix table?

hi all,
i want to get the headers of an informix table,i ve tried the commands:
describe mytable;
info columns for mytable;
the last one works with informix version 4,the version of my informix server is 7.and i use jdbc to connect with informix.
thanks for the help
Reply With Quote
  #2 (permalink)  
Old 04-01-04, 14:58
RobP RobP is offline
Registered User
 
Join Date: Mar 2004
Location: Netherlands
Posts: 183
Hi,

The INFO command should still wortk (I thoughy). The problem you have is the JDBC driver (I think). I would suggest reading the information directly from the systables. For example if you wish to retrieve the columns in a table you could do:

SELECT colname
FROM syscolumsn
WHERE tabid = (SELECT tabid
FROM systables
WHERE tabname = '<tablename>')
ORDER BY colno

If you use a version prior to 9.40 you shuld also select colno to do the order by, it is a new feature in 9.40 to order the result set on a column /expression you do not select.

Hope this can do the trick,

Rob Prop
Reply With Quote
  #3 (permalink)  
Old 04-02-04, 06:01
amachou_doubaji amachou_doubaji is offline
Registered User
 
Join Date: Mar 2004
Posts: 10
thanks

thanks for your help,we ve found another solution with using ResultSetMetaData rsmd = RS.getMetaData();
rsmd.getColumnName(i)
thank you.




Quote:
Originally posted by RobP
Hi,The INFO command should still wortk (I thoughy). The problem you have is the JDBC driver (I think). I would suggest reading the information directly from the systables. For example if you wish to retrieve the columns in a table you could do:

SELECT colname
FROM syscolumsn
WHERE tabid = (SELECT tabid
FROM systables
WHERE tabname = '<tablename>')
ORDER BY colno

If you use a version prior to 9.40 you shuld also select colno to do the order by, it is a new feature in 9.40 to order the result set on a column /expression you do not select.

Hope this can do the trick,

Rob Prop
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On