How to connect jdk1.6 as front end and ms access 2007 as back end for my project
I want to build new "issue tracking system" project which is based on JAVA. I want to use jdk1.6 as front end and ms access 2007 as back end. Can anyone describe code for making connectivity between this front and back end of the software. Thanks for any such help.
Re: How to connect jdk1.6 as front end and ms access 2007 as back end for my project
In this situations, you can take help of JDBC connectivity. This jdk1.6 is java file and it works to run java programs. while the MS access 2007 helps to create and maintain database records. So, JDBC works to make connectivity within this front end and back end of your project.
Re: How to connect jdk1.6 as front end and ms access 2007 as back end for my project
Yes, using JDBC connectivity you can make such connections. You need to put such code on your java project file. As well as you need to set the global data access objects for your project. so that you can simply access the sql extension file in your system that you run project. It can be set by go to Control Panel-> Administrative Tools-> Data Sources(ODBC). In that make the new database entry. refer the sql file that you used as a back end. its well for you.
Re: How to connect jdk1.6 as front end and ms access 2007 as back end for my project
For the connectivtiy between the Java Application with the MS-Access database is simple. So for that you have to first import the java.sql package
import java.sql.*;
After that you have to load the JDBC driver. By using the static method Class.forName("DriverType"); There may be the chances for getting the Driver niot found exception to be thrown. So for that you have to make the use of try-catch block. So inside that try-catch block you have to write this code for loading the JDBC Driver.
After loading the Driver, you can make the connection with the MS-Access Database that you want to connect with that program or the Application,
So to connect with the database, you just have to make the use of the DriverManager.getConnection(); static method with the parameter as the DSN Name that you have created for that database.
After getting the connection with the respective database by using the DSN name, you can now able to execute the SQL command and Query. With the help of the instance of Statement, PreparedStatement and CallableStatement class you can execute the SQL query.
All the demo for the connection and for the SQL query is as follow
Quote:
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con= DriverManager.getConnection("jdbc:odbc:dsn_Name");
Statement st= con.createStatement();
st.execute("Create table Abc(fname String, lname String)");
System.out.println("Table ABC Created Successfull");
}
catch(Exception e)
{
System.out.println("ERROR FOUND"+e);
}
So may be this will help you out to get some basic for the creation and the connection of the Java with the MS-Access database.