This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes JDBC and the fly likes Searching Database Tables Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Searching Database Tables" Watch "Searching Database Tables" New topic
Author

Searching Database Tables

Faisal Fuad
Ranch Hand

Joined: Jul 05, 2011
Posts: 76

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

Joined: Mar 18, 2011
Posts: 312

In JDBC, you have *MetaData interfaces that will give you the information you need.


S.D. MADHAN
Not many get the right opportunity !
Santhosh ayiappan
Ranch Hand

Joined: Jan 30, 2007
Posts: 80

below code would give you the column names of a particular table.

>
Faisal Fuad
Ranch Hand

Joined: Jul 05, 2011
Posts: 76

Thank you both. Specially Santhosh...your given sample code did save a lot of my time.
God bless
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Searching Database Tables
 
Similar Threads
Automatic table creation
describing the table!!!...
html:link problem
hashmap and jdbc
Hibernate one-to-one mapping with foreign key