Tuesday, December 18, 2012

Creating Data Source Object in Windows for type 1 JDBC Driver


database is a structured collection of data. The data are typically organized to model relevant aspects of reality (for example, the availability of rooms in hotels), in a way that supports processes requiring this information (for example, finding a hotel with vacancies).

Datasource is a name given to the connection set up to a database from a server. The name is commonly used when creating a query to the database.
JDBC is a Java-based data access technology (Java Standard Edition platform) from Sun Microsystems. It is an acronym as it is unofficially referred to as Java Database Connectivity.

The JDBC type 1 driver, also known as the JDBC-ODBC bridge, is a database driver implementation that employs theODBC driver to connect to the database. The driver converts JDBC method calls into ODBC function calls.The driver is platform-dependent as it makes use of ODBC which in turn depends on native libraries of the underlying operating system the JVM is running upon.
Functions :
Translates a query by JDBC into a corresponding ODBC query, which is then handled by the ODBC driver.
Advantages :
Almost any database for which ODBC driver is installed, can be accessed.
Disadvantages :
  • Performance overhead since the calls have to go through the jdbc Overhead bridge to the ODBC driver,then to the native db connectivity interface (thus may be slower than othe types of driver).
  • The ODBC driver needs to be intalled on the client machine.
  • Not suitable fo rapplets, because the ODBC driver needs to be intalled on the client.

Steps to Create Object Data Source :


Step 1 :
Search for ODBC Data Source Administrator in the Start menu.
Select ODBC Data Source Administrator.

Step 2 :
Window : ODBC Data Source Administrator
Under the "User DSN" tab click "Add" Button.
Step 3 :
Window : Create New Data Source
Select " Microsoft Access Driver(*.mdb,*.accdb)"
Click "Finish"
If you can find the option it is due to the Driver Problems , maybe because your system has 64 bit operating system.
To build and run an application as a 32-bit application on a 64-bit operating system, you must create the ODBC data source with the ODBC Administrator in %windir%\SysWOW64\odbcad32.exe.


Step 4 :
Window : ODBC Microsoft Access Setup
Name the Data Source. (Here CMDSN)
DSN name is Case sensitive so be careful.
It should be the same as the DSN name in you Java Program. 
Then click "Select"






Step 4 :
Window: Select Database
Browse the Directories for you MS Access Database.
Then Select the required Database in the left panel and the click "OK"
The "List Files of type:" should be "Access Databases"







Step 4:
Window: ODBC Microsoft Access Setup
Click "OK"
The Selected file Path and Name is shown beside the "Database" Label
Click "OK" 
DONE

NEXT:
You can now Manipulate you tables through you Java Program.





[edit]


No comments:

Post a Comment