background image

Creating the Database Tables

<< Building the order Application | Packaging the order Application >>
<< Building the order Application | Packaging the order Application >>

Creating the Database Tables

Creating the Database Tables in NetBeans IDE
To create the database tables in Java DB, the database server included with Application Server,
you need to create the database connection and execute the SQL commands in
tut-install/examples/common/sql/javadb/tutorial.sql.
Creating the Database Connection
To create the database connection do the following:
1. Click the Runtime tab.
2. Right-click the Databases node and select New Connection to open the New Connection
dialog.
3. Under Name, select Java DB (Network).
4. Set Database URL to the following:
jdbc:derby://localhost:1527/sun-appserv-samples
5. Set User Name to APP.
6. Set Password to APP.
7. Select the Remember Password during this Session box.
8. Click OK.
Creating the Tables
To create the tutorial tables, do the following:
1. Select File
Open File.
2. Navigate to tut-install/examples/common/sql/javadb/ and open tutorial.sql.
3. In the editor pane, select the connection URL to Java DB:
jdbc:derby://localhost:1527/sun-appserv-samples
4. Click the Run SQL button at the top of the editor pane.
You will see the output from the SQL commands in the Output tab.
Deleting the Tables
To delete the tutorial tables, do the following:
1. Select File
Open File.
2. Navigate to tut-install/examples/common/sql/javadb/ and open delete.sql.
3. In the editor pane, select the connection URL to Java DB:
jdbc:derby://localhost:1527/sun-appserv-samples
The order Application
The Java EE 5 Tutorial · September 2007
722