Creating A DSN - Java Database Connectivity

Home  »  Java  »  Advance Java  »  Java Database Connectivity  »  Creating A DSN


After create table in database the next step is to create DSN - ODBC Driver:

Create the ODBC driver via which the Java UI will communicate with the database tables as described in the following pages.

The steps for creating the ODBC Driver on a Windows 95/98/2000/XP...etc... computer is as follows:

Click on 'Start -> Control Panel -> Administrative Tools' as shown in below Diagram 22.11.

Diagram 22.11



Select the 'Data Sources (ODBC)' from the Control Panel. When this is done the ODBC administrator interface will open up as shown in diagram 22.12.

Diagram 22.12





The ODBC data source administrator allows the creation of several types of Named Data Sources. Select 'System DSN' from the tabbed notebook shown.

Once the System DSN page is selected from the 'Tabbed Notebook', click on the 'Add button on the interface.

This will open up another interface, which will display all the ODBC drivers installed on the current computer. Each ODBC driver will communicate effectively with the database for which the driver was built.

Select the appropriate driver, in this case Microsoft Access Driver [.mdb]. Please refer to diagram 22.13.

Diagram 22.13


Once the 'Microsoft Access Driver [.mdb]' ODBC driver has been selected as the driver of choice, Click on the 'Finish' button on the interface to complete creating the system DSN. The interface as shown in Diagram 22.14 will appear.

Diagram 22.14



Fill in the Data Source Name field on the interface. Thus giving the DSN a 'Name'. In this case the name given is 'MyDsn'.

Use the 'Select' button on the interface and select the Access .mdb by browsing through the directory tree structure of the hard disk until the Access .mdb file is located.

Once these steps are completed, ODBC , named Data Source (driver) exists and has been registered with the computer. This driver knows where the MS Access database, is and can communicate with any of its tables.

The System DSN now exists. The DSN is aware of the existence of the MS Access database.




Create the Database.
Creating a DSN.
Connecting to a Database.
Creating & Executing Statements.
Closing a database connection.






JDBC - Programming:

View records from the Access/SQL table.
Inserts records into the Access/SQL table.
Updates records into the Access/SQL table.
Deletes records from the Access/SQL table.
Drops the Access/SQL table.




JDBC - Working With User Interfaces - Using Swing Compoents

Inserts records into the Access/SQL table using Swing Components
View records from the Access table/SQL using Swing JTable
Updates records into the Access/SQL table using Swing Components
Deletes records from the Access/SQL table using Swing Components





1 comment: