Results 1 to 10 of 10
- 07-30-2009, 11:26 PM #1
Member
- Join Date
- Jul 2009
- Posts
- 8
- Rep Power
- 0
New simple application using a simple database
Hi,
i want to learn how to do a simple application using Java and a database.
Something like:
1. A window which contains 2 text inputs and an "Submit" button.
The user types let's say his name and age, and after he clicks on "Submit", the data is stored into my database.
2. A second window which will contain one text input and the "OK" button.
After i type a random name, i want to print or display the data for that name (name and age).
Can you tell me where should i start?
P.S. I do know things related to panels, adding buttons to panels, etc.
What i don't know is how to work with databases, how to store and retrieve the data from databases.
- 07-31-2009, 02:32 AM #2
Read about the Java DataBase Connector (JDBC) and Structured Query Language (SQL). There's plenty more on our Databases board.
Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
How To Ask Questions The Smart Way
- 07-31-2009, 04:31 AM #3
I get the feeling you don't want to connect to an actual database (MySQL, etc...) one that you create yourself (something simple made just for the purposes of your program).
You can make a simple database with an ArrayList, and use the methods in the Collections package for sorting, and you could write a simple binary search for lookup. If you want a little more challenge, you could do the same thing with a Hashtable, which would make for more efficient loopups.
Once you can insert new items and get them back out, then start looking at GUI stuff.
- 07-31-2009, 03:53 PM #4
Member
- Join Date
- Jul 2009
- Posts
- 8
- Rep Power
- 0
- 07-31-2009, 05:36 PM #5
- 08-01-2009, 12:19 AM #6
Member
- Join Date
- Jul 2009
- Posts
- 8
- Rep Power
- 0
Here's what i've done so far:
I read and done this tutorial: netbeans.org/kb/docs/java/gui-db.html#running-outside-IDE
At the end of it i had a 100% running application.
I tried to run the .jar file on a different computer, but no result.
How can i make a database Java application that will run on any computer?
- 08-01-2009, 03:04 AM #7
Why wouldn't it run on another computer? What was the console output when you ran it?
- 08-01-2009, 10:51 AM #8
Member
- Join Date
- Jul 2009
- Posts
- 8
- Rep Power
- 0
I tried to run the project on the other computer by double clicking the .jar file.
There was no console output. Nothing happened.
Here is what i still don't understand: How can i create an application which will have a database embedded, which will also run on any computer?
- 08-01-2009, 05:29 PM #9
Member
- Join Date
- Jul 2009
- Posts
- 35
- Rep Power
- 0
Research SQLite; make sure to look at its implementations because there are some pitfalls you may fall into (although for a small app, some may not matter/be noticeable).
But yeah, there are implementations of SQLite for Java although I haven't found a way to view/manage the tables/dbs yet. Maybe someone else can link a program that does this.
- 08-03-2009, 02:55 AM #10
adz is right about SQlite -- its what ruby on rails uses for an embedded database.
As far as console output -- there is always console output, you just may not have been looking at it. Run the jar file from the command line--
java -jar myJar.jar
And see what errors it prints. I suspect you used absolute paths or loopback ip for a server running locally, or something of the sort.
Similar Threads
-
JSP simple application
By Ms.Ranjan in forum JavaServer Pages (JSP) and JSTLReplies: 4Last Post: 10-04-2008, 10:08 AM -
Simple example Client Server Application
By ferosh in forum NetworkingReplies: 1Last Post: 04-01-2007, 10:36 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks