This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I'm beginner in Java programming..
I have an exam with programming, i have a task to create a application with java.swing*, through swing* , I have to create a connection with database oracle.
I need a code with swing, a text field, when i type a database query, this query will execute and will get the data in database oracle and will show them in application.
1. Initially you have to write code for your driver registration.like Class.forName(oracle driver)
2.You will get connection object
3.You will get statement object
4.execute your query
5.You will get record set.
6.Pick up a record form record set and set it to your swing component for example textField like that textField.set(value).
If you follow above step then it will work smoothly. let me know if you will struck anywhere.
I would recommend you start by getting the database connection working with a Java™ program running on the command line. And I recommend the Java Tutorials to help learn how to do that.
Then you can add Swing (not swing*) components later.
Joined: May 21, 2012
Thanks for quick replay
I connected code with database oracle through drivers, and when I write a query in code , a string, i take the result about that query what i asked.
What I don't know is swing. As I said, i need to open a window (application based on swing ), and in that window which must contain a text field, so, when i type a query in that field, i must get the result from database, same as i get from string which wrote in code.
What I just want to ask you guys is, if someone had a task like that, or have a code like that..
I'll thankful for any help..
Thanks a lot
Joined: Oct 13, 2005
You can have a look at the Java™ Tutorials, which has lots about using Swing (not swing). Try here.