Use NetBeans to connect the GUI to the Derby database

Source: Internet
Author: User
Tags netbeans

This tutorial guides you through how to connect the GUI for an application named Contacteditor to the Derby database. In this process, you will add a data-sensitive JDBC component to the GUI to enable the program to interact with the employee database.

In this tutorial, you will learn how to:

L Use GUI Builder interface

L Connect two GUI windows

L Add and edit Jdbcrowset

L Add Data Model

• Connecting the GUI to the Derby database

L BIND data to UI components

• Connecting UI components to application logic

This tutorial takes approximately 30 minutes to complete.

Please note that this tutorial refers to a project named GUI DB Exercise Initial as a sample for you to refer to when using these steps. Also note that the GUI DB Exercise Final project in the archive shows the completed application.

Entry

In the GUI Builder Quickstart Tutorial, we are committed to building a dialog box named Contacteditorui for the Contacteditorui.java application. In this tutorial, we connect the previously created Contacteditorui GUI form and the main (parent) window of the application UI to the Derby database. Note that although the pictures in this tutorial illustrate the process on the Macintosh os-x, the steps are almost identical on other support platforms, such as Windows or Solaris.

To successfully complete this tutorial, you must have installed and are running the Derby database server that the IDE contains. Note that when you go to the NetBeans IDE 5.5 beta, the included database is no longer called Derby, but is called Java DB. You will also need to compile the necessary support classes (visible in the Project window) that are included in the sample project into the project. For more information about installing and configuring Derby for use in NetBeans, see NetBeans Derby Tutorial.

Finally, you must have created the Contact_database and set the User Name and Password to Nbuser. You also add the necessary fields to the database by using the Create Table UI or by executing the following SQL statement:

CREATE TABLE "CONTACTS"
(
"ID" INTEGER not null primary key,
"FIRST_NAME" VARCHAR(50),
"LAST_NAME" VARCHAR(50),
"TITLE" VARCHAR(50),
"NICKNAME" VARCHAR(50),
"DISPLAY_FORMAT" SMALLINT,
"MAIL_FORMAT" SMALLINT,
"EMAIL_ADDRESSES" VARCHAR(1000)
)

Note that if you create a table using SQL commands instead of the CREATE table UI, you will need to refresh the tables node in the Runtime window to see the Contacts table.

Note: To successfully complete this tutorial, you must run NetBeans IDE 5.0 on JDK 5.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.