• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Searching Database Tables

 
Faisal Fuad
Ranch Hand
Posts: 83
IBM DB2 Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Need some Hints. I would like to create a search engine type stuff where user will enter ID and press enter which then will go all the available tables into the database one by one, search of that ID and if found then present all the related information of that ID along with the Table name.

Now important point to note is that, in database each table colum formats are different and there i am facing the problem.

I have done this stuff in VB.NET and thats very simple by using GridView. But how can i do that with JSP-Servlet? I have to show each table name, there column title names as well as related info about the selected ID below the column title row.

I read some articles where many of them are doing this:



But that is sort of hard coded right? In this case You know the column title and so you can do the above thing. What if you only know the table name but don't know the column structure for each table. Then?

Hope i explain the problem clearly. Please give me some nice hints. Thanks
 
Madhan Sundararajan Devaki
Ranch Hand
Posts: 312
Java MS IE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In JDBC, you have *MetaData interfaces that will give you the information you need.
 
Santhosh ayiappan
Ranch Hand
Posts: 80
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
below code would give you the column names of a particular table.

>
 
Faisal Fuad
Ranch Hand
Posts: 83
IBM DB2 Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you both. Specially Santhosh...your given sample code did save a lot of my time.
God bless
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic