CONNECTION OF M.S. ACCESS DATABASE WITH JAVA
In our previous
article we taught you How to do communication between jsp and servlet? But In
Web Application Database connection is most important part. So we decided to
teach you Basic tutorial on M.S. ACESS database connection with java.
For connect
M.S. ACCESS database with java in windows 7 or windows 8 you must require
odbcad32.exe. This Driver is already available in your System folder. Just
follow the bellow step for connect M.S. ACCESS database.
Step1:- Create a database in M.S. ACCESS and create table named basic_info. Save this table and close your database.
Step2:-Go to control-panel->Administrative tools and then right click on odbc datasource and go to its property. After that navigate the bellow path
C:->windows->sysWOW64->odbcad32.exe and then paste
this path in target field of odbc datasource’s property.
Step3:->now restart control panel and navigate the path up to odbc datasource .Now click on odbc datasource and one window is popup after that click on add button at right side of the window. And you can see a new pop up window as given bellow.
Now double click on Microsoft Access Driver(.mdb , .accb) as
given in above image.
Step4:->Now as given in bellow figure write a dsn (Data Source Name) name and then select database which you have created in step 1 and click ok.
Now it’s time to programming in jsp and servlet
Step5:->Create one form which contains your basic information and pass parameters from this jsp page to store.java servlet.
Step6:->Now in servlet first, you have to store all parameters in Strings. After that you need to write a code which connects your servlet to M.S.ACCESS database. Follow this code for connection of database.
Note:-Make sure that in line of connection at last you have to write a dsn name which you have given in step 4.
Step 7:->Now you have done a connection of m.s.access database with java.For see the result just run your program and after that open your M.S.ACCESS database and you can see that your information is added in database.
So friends these are the steps for how to connect M.S. access database with java.If you found that this article is helpful to you then Share it with your friends. And feel free to ask any one question related to java. Have a nice day
No comments:
Post a Comment