This week's giveaway is in the Programmer Certification (OCPJP) forum.
We're giving away four copies of Java Mock Exams (software) and have David Mayer on-line!
See this thread for details.
Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to display data in dropdown box from database using java code

 
murali maddy
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
i have a small issue to be solved.i am using mysql database and i have 6 tables.i need to retrieve data from database and i have to display that in dropdown for example i have to display all the states names in drop down like that cities,areas...so please help me in this issue
 
Campbell Ritchie
Marshal
Posts: 53135
124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

I am afraid that is too large a question to answer in a posting; you will need to find the Java Tutorial about databases, then download a MySQL connector.

You will have to look up tables in the Java Tutorials, too, the work out which Component to add your table to.
 
Manuel Leiria
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and what exactly have you done? Can you successfully retrieve the data?
 
Srikanth Basa
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
They are two different things in your question. Here is what you have to do first

1. Understand how data can be retreived using JDBC
2. Know how you populate the UI dropdown (which technology you are using is unclear)

There are plenty of examples on the net. Just search for JDBC data (Refer this http://web.njit.edu/all_topics/Servers/MySQL/Docs/mySample.java.html)
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!