Today, I am gonna show you how to connect to a Microsoft Office Access database, For such you will need following prerequisites :
- Java (JDK)
- MS Access
First of all, open MS Access and select a blank database, name it with anything you want.
once opened, put ID and name in column and save database, Then it will ask you to name your database. Name it as say "user" and do exit.
Open Control panel, once opened jump to View By, select large icons. after doing you will see something called as Administrative Tools. Open it, A window will appear and thereafter look for "ODBC Data Sources (64-bit)/ODBC Data Sources (32-bit)". Double click one of it according to your need. A new window will appear, where you going to add your database and make a JDBC-ODBC Bridge.
So select add, then select Microsoft Access Driver (*.mdb ,*.accdb) and click finish. Then
ODBC Microsoft Access Setup window will appear.
Put data source name anything say ADB, skip the description. now there is one select button, click on it and search the path where you saved the database earlier and click OK.
Now in Database Source Administrator You will see the name of your database source. let it be there and click OK.
That's all!
Now you have to do is write a java program to connect to your database or simply can test my program
JAVA PROGRAM
DATABASE
Enjoy Coding!