Create the MYSTORE Database for the Application
By default, VWP comes with a test database named Travel. You won't be using that database in this article, so you have to install a new one that matches the right conditions. To do this, download the MYSTORE.zip archive and extract the content in the directory where the other NetBeans databases are. If you do not know where to put it, launch NetBeans and check this:
Tools::Options::Advanced Options::IDE Configuration::Server and External Tool
Settings::Java DB Database
Looking at the panel on the right, you will notice the database's location property. That's the directory in which you'll place the new database, named MYSTORE. Now, start NetBeans and set up a new connection for this database. Access the Runtime window (if is not visible, display it from Window::Runtime or Ctrl+5) and expand the database node. Right-click on this node and select the New Connection item from the popup menu. This will display the New Database Connection window. Populate the text fields as follows:
- Database URL:
jdbc:derby://localhost:1527/MYSTORE
- User Name:
MYSTORE
- Password:
MYSTORE
Click OK and wait for connection to be established. A new JDBC connection should appear in the connection list under the Databases node.
Before you start developing your application, copy and unzip the img.zip directory in any directory on your computer. Later you will use this directory to upload product images, so don't forget where you put it.
Create the Application Using VWP
The sample application you'll be building is a simple interface to administrate the database of an e-commerce site. To begin, open NetBeans and create a new application:
- From the File menu, choose the New Project item.
- From the New Project window, select Web from Categories and Visual Web Application from Projects. Then click Next.
- For the Project Name, type
MyStoreAdminGUI.
- For the Server, choose Sun Java System Application Server 9.
- For the Java EE Version, choose Java EE 5.
- Click Finish.
The Design window should look something like Figure 2.

Figure 2: The Newly Created Application
Next, start the Java DB server and connect to the MYSTORE database:
- From the Tools menu, choose Java DB Database::Start Java DB Server.
- From the Runtime window, expand the Database node and select the connection specific to the
MYSTORE database.
- Right-click on it and select the Connect item from the popup menu.
- In the Connect window, type
MYSTORE in the Password text field. Then click OK.
New on the Java Boutique:
New Review:
Time Management Made Easy with the Quartz Enterprise Job Scheduler
Why not just use the Java timer API? This open source scheduling
API boasts simplicity, ease-of-integration, a well-rounded feature
set, and it's free!
New Applet:
Reverse Complement
Reverse Complement is a simple applet that converts DNA or RNA
sequences into three useful formats.
Elsewhere on internet.com:
WebDeveloper Java
Lots of Java information on webdeveloper.com
WDVL Java
Thorough Java resource at the Web Developer's Virtual Library.
ScriptSearch Java
Hundreds of free Java code files to download.
jGuru: Your View of the Java Universe
Customizable portal with online training, FAQs, regular news updates, and tutorials.
|