File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Requirements for building Java GUI to access MySQL Database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Requirements for building Java GUI to access MySQL Database" Watch "Requirements for building Java GUI to access MySQL Database" New topic
Author

Requirements for building Java GUI to access MySQL Database

Ibn Saeed
Ranch Hand

Joined: Jun 17, 2009
Posts: 45
Can anyone list the requirements (i.e. any books, tutorials, libraries etc) to build an application in Java, which could communicate with MySQL Database.

I am running an online store built in PHP and MySQL. I would like to build a Java Application through which I can (CRUD) Products, Categories, Orders etc.

My Database is already built in MySQL and all the data is present. So i only need to work on a GUI App which can access my Store's data.

Also, is it possible to build a small Windows Popup Ballon , which could appera and inform me whenever a new order has been placed on my shopping cart.

Here is an example application built in Delphi which acts as a Front End (Store Manager) for oscommerce shopping cart.











I only need a direction/path(i.e. any books, tutorials, libraries etc) to take in order to build an application like the one posted above.





.
Fred Hamilton
Ranch Hand

Joined: May 13, 2009
Posts: 679
The following page has a downloadable zip file which contains a large selection of sample JDBC related code.

http://java.sun.com/products/jdbc/reference/codesamples/index.html

The following page has a complete example of connecting to a mySQL database that I found quite helpful

http://www.roseindia.net/jdbc/jdbc-mysql/MysqlConnect.shtml

Then there is the Sun Java Tutorial which provides a more thorough approach to the subject.

http://java.sun.com/docs/books/tutorial/jdbc/index.html

These materials are not really GUI specific, but database connectivity doesn't really concern itself with whether or not your app is GUI.
Fred Hamilton
Ranch Hand

Joined: May 13, 2009
Posts: 679
OK, as I look back, I don't know if this is useful, I'm not sure if you need help with JDBC or with building a GUI, which is two separate issues as I see it.

p.s. These materials are suitable as an introduction to JDBC, but I don't claim that this is all you need to build a professional quality database application.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39784
    
  28
You have quoted useful stuff, Fred. We don't have the facilities on this website to teach people everything about building a website, but we usually discuss them on the JDBC forum. Moving thread.
Ibn Saeed
Ranch Hand

Joined: Jun 17, 2009
Posts: 45
@Fred, thank you for the links. I will take a look at them.

I am not looking for developing a Website, I already have a php shoppping cart working.

I just need a GUI Application built in Java as a FrontEnd which would interact, CRUD with MySQL database.

Yes, I need to build a Windows Application (in Java) and acess my MySQL Database, i think it would be JDBC. Can H2, Derby or HSQLDB be used such in the same manner as JDBC ? I have no experience with building a GUI In Java and I have not experience in building a Desltop Application in Java.




I searched Google and I found the following tutorials, please let me know if i am on the right track:

Step-by-step tutorial on how-to develop the Java Desktop Graphical User Interface (GUI) applications using NetBeans IDE with database
In this series of three parts, we will learn how to build Java desktop GUI application that connected to MySQL database. This tutorial is quite long containing a lot of screen snapshots to make it as details as possible. The original tutorial can be found at netbeans.org. All credits must go to the original authors.

http://www.netbeans.org/kb/docs/java/gui-db.html





Creating a Custom Java Desktop Database Application
This tutorial guides you through the creation of a complete desktop database application that enables its user to browse and edit customer records and purchase history. The resulting application includes the following main features:

* A main view that enables users to browse customer records and customer purchases.
* A search field for the customer records.
* Separate dialog boxes for entering new records or modifying existing records.
* Code to interact with multiple related database tables.

http://www.netbeans.org/kb/docs/java/gui-db-custom.html




Making a simple MySQL client in NetBeans
NetBeans has a nice interface to connect DB, but many SQL commands are to be input as a whole sentence I made Swing application for inserting and viewing data to a table of MySQL database. The sample is very simple, available for one specific table and without deleting or updating operation

http://www.netbeans.org/kb/articles/mysql-client.html





Using Hibernate in a Java Swing Application
In this tutorial, you use the NetBeans IDE to create and deploy a Java Swing application that displays data from a database. The application uses the Hibernate framework as the persistence layer to retrieve POJOs (plain old Java objects) from a relational database.

The application that you build in this tutorial is a companion administration application for the DVD Store web application. This tutorial covers how to create an application that allows you to query an actor's profile based on the match with first name or last name. If you wish you can extend the application to query film details and to add/update/delete items. This tutorial uses MySQL and the Sakila database, but you can use any supported database server with Hibernate applications.

http://www.netbeans.org/kb/docs/java/hibernate-java-se.html






Building a Java Desktop Database Application

This tutorial shows how to create a desktop Java application through which you can access and update a database. The tutorial takes advantage of support in NetBeans IDE for the following technologies:

* The Java Persistence API (JPA), which helps you use Java code to interact with databases.
* Beans Binding (JSR-295), which provides a way for different JavaBeans components to have property values that are synchronized with each other. For example, you can use beans binding to keep the values of cells in a JTable visual component in synch with the values of fields in an entity class. (In turn, the entity class represents the database table.)
* The Swing Application Framework (JSR-296), which provides some useful building blocks for quickly creating desktop applications.

We will create a database CRUD (create, read, update, delete) application with a custom component used for visualizing the data (car design preview).

http://www.netbeans.org/kb/docs/java/gui-db.html



Are there any Books I should read ? Do I need to learn Hibernate or Beans or JPA etc.


.
Fred Hamilton
Ranch Hand

Joined: May 13, 2009
Posts: 679
Ibn, seeing as how you have no experience building a GUI in java, the links you provided strike me as a little advanced. Perhaps they are not suitable for an absolute beginner to GUI programming in Java.

The part of java that is involved with creating a GUI is called Swing. A Desktop GUI like the one you displayed will make use of JFrame, JPanel, JTable, JButtons, JMenu, and probably JDialog. These are all Swing components.

Data from a database is typically displayed in a JTable, and the JTable is stored in a JFrame.

Anyways, that's a simplistic view of things, I can only suggest that you learn the basics of these concepts before delving into the links you have provided above.

Look on the Internet for some introductory tutorials on java Swing programming. If you have some programming experience, then the Sun java Tutorial on this subject is appropriate. Once you understand the basics of Swing, you can move on to these other links you have provided.

http://java.sun.com/docs/books/tutorial/uiswing/index.html
Ibn Saeed
Ranch Hand

Joined: Jun 17, 2009
Posts: 45
Fred Hamilton wrote:Ibn, seeing as how you have no experience building a GUI in java, the links you provided strike me as a little advanced. Perhaps they are not suitable for an absolute beginner to GUI programming in Java.

The part of java that is involved with creating a GUI is called Swing. A Desktop GUI like the one you displayed will make use of JFrame, JPanel, JTable, JButtons, JMenuItems, and probably JDialogs. These are all Swing components.

Data from a database is typically displayed in a JTable, and the JTable is stored in a JFrame.

Anyways, that's a simplistic view of things, I can only suggest that you learn the basics of these concepts before delving into the links you have provided above.

Look on the Internet for some introductory tutorials on java Swing programming. If you have some programming experience, then the Sun java Tutorial on this subject is appropriate. Once you understand the basics of Swing, you can move on to these other links you have provided.

http://java.sun.com/docs/books/tutorial/uiswing/index.html


Thank you for an informed post, Fred.

I will take your advice and start off with learning a GUI Library and after I am comfortable with it, i will move onto JDBC.

Now, before I begin with learning the GUI part, should I start off with Swing or SWT etc ? I have read that there isnt much development going on at Swing ? So I am a little concerned, if i start off with Swing and in the future, the development completely ceases, I would be stuck. So would you kind to direct me on chosing the best possible GUI library to start off with.


Fred Hamilton
Ranch Hand

Joined: May 13, 2009
Posts: 679
I am not aware that there is very little going on with Swing. but I'm not an advanced GUI programmer by any stretch. But I'm pretty good with the basics. There's other people here who know a lot more than I do about GUIs. Perhaps if you narrowed the discussion to just GUI programming, and posted a question in the Swing.GUI forum, someone could help.
Ibn Saeed
Ranch Hand

Joined: Jun 17, 2009
Posts: 45
Fred Hamilton wrote:I am not aware that there is very little going on with Swing. but I'm not an advanced GUI programmer by any stretch. But I'm pretty good with the basics. There's other people here who know a lot more than I do about GUIs. Perhaps if you narrowed the discussion to just GUI programming, and posted a question in the Swing.GUI forum, someone could help.


Thanks, ill do that.
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30913
    
158

Moving to our GUI forum now that the topic has shifted.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
 
subject: Requirements for building Java GUI to access MySQL Database