This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

DatabaseMetaData strange behavior

 
Lukas Alamar
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi ranchers
im a bit stuck on a problem so i need your help!

i have a very easy piece of code that uses a Connection and a DatabaseMetaData to retrieve tables and their columns .. so far so good .. for a bunch of tables the number of columns is doubled!! and i dont know why ..



then i get "MYTABLE cols=8" for .. say ..a table with only 4 cols ..

i know it may be trivial for some of you but that's my first attempt at using DatabaseMetaData

thanks for any help
[ March 28, 2006: Message edited by: Lukas Alamar ]
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34084
337
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lukas,
I suspect there may be some hidden columns. The easiest way to confirm that or see what is going on is to print out colRset.getString("COLUMN_NAME") within your loop. Then you can see precisely what is being returned.
 
Lukas Alamar
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Jeanne,
thanks for your reply
i did what you suggested and here's the output for one of those weird tables:

WEIRD_TABLE
C_KEY
N_PRG
T_DES
D_TMP_INS
C_KEY
N_PRG
T_DES
D_TMP_INS

obviously if i check the table with my db client i see only the first 4 columns!

most of the tables are correct .. this behavior is just for a few of them

(im feeling very ignorant ..)
[ March 30, 2006: Message edited by: Lukas Alamar ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic