Building a Java Desktop Database Application – NetBeans 6.0 Tutorial

ADVERTISEMENT


Building a Java Desktop Database Application - NetBeans 6.0 Tutorial cover page
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

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). This tutorial is largely based on a screencast that was based on a development build. Some of the user interface has changed since that demo was made, so you might notice some differences between this tutorial and the demo. You can view the demo (about 9 minutes) now or download a zip of the demo . Expected duration: 45 minutes To follow this tutorial, you need the software and resources listed in the following table. Setting Up the Database Before you begin creating a desktop CRUD (create, read, update, delete) application in the IDE, you should already have the IDE connected to the database that your application will use. Having this connection set up in advance will allow you to take advantage of IDE features that automate the binding of the database to your application. In this tutorial, we provide instructions for using a Java DB database, since there is a convenient interface for starting and stop the Java DB database server from the IDE. However, you can use a different database server without too much difficulty. First verify that you have Java DB registered in the IDE. Java DB is automatically registered in the IDE in a number of cases, such as when you have Sun Java System Application Server registered in the IDE or when you are running on JDK 6. If Java DB is not registered in the IDE, register it manually. To verify whether Java DB is registered in NetBeans IDE 6.1: 1. Open the Services window. 2. Right-click the Databases > Java DB node and choose Properties. If Java DB is registered, the Java DB Installation and Database Location fields will be filled in. If Java DB is not registered, fill in the following two fields: * Java DB Installation. Enter the path to the database server. * Database Location. Enter the folder where you want the databases to be stored. 3. Click OK. To verify whether Java DB is registered in NetBeans IDE 6.0: 1. Choose Tools > Java DB Database > Settings. If Java DB is registered, the Java DB Installation and Database Location fields will be filled in If Java DB is not registered, fill in the following two fields: * Java DB Installation. Enter the path to the database server. * Database Location. Enter the folder where you want the databases to be stored. 2. Click OK. Starting the Server and Creating a Database Once Java DB is registered with the IDE, you can easily start and stop the database server, as well as create a new database. To start the database server in NetBeans IDE 6.1: * In the Services window, right-click Databases > Java DB and choose Start Server. If you do not already have a location set for the database, the Set Database Location dialog box appears. Enter a location for the database server to store the databases. You can create a new folder there if you wish. To start the database server in NetBeans IDE 6.0: * Choose Tools > Java DB Database > Start Server. If you do not already have a location set for the database, the Set Database Location dialog box appears. Enter a location for the database server to store the databases. You can create a new folder there if you wish. Once the server is started, Java DB Database Process tab opens in the Output window and displays a message similar the following …

Download Building a Java Desktop Database Application – NetBeans 6.0 Tutorial.pdf

Leave a Reply


Map: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67