plz help me How to link Access data base with java code.
public class DataBaseCon {
public static void main(String a[]) throws Exception{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:DataBase");
System.out.println("Sucessfully Connected ");
Statement st= con.createStatement();
ResultSet rs= st.executeQuery("Select empid,ename from emp");
while(rs.next()){
System.out.print(rs.getString(1));
System.out.println(rs.getString(2));
}
st.close();
con.close();
}
}
Exception in thread "main" java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6956)
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7113)
at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(JdbcOdbc.java:3072)
at sun.jdbc.odbc.JdbcOdbcConnection.initialize(JdbcOdbcConnection.java:323)
at sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:174)
at java.sql.DriverManager.getConnection(DriverManager.java:579)
at java.sql.DriverManager.getConnection(DriverManager.java:243)
at databasecon.DataBaseCon.main(DataBaseCon.java:15)
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)
it throw this Exception...
help me if i do wrong some thing ..plz
Thanks