//Select Query example Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection ct = DriverManager.getConnection("jdbc:odbc:DATASOURCE NAME", "USERNAME", "PASSWORD"); PreparedStatement s = ct.prepareStatement(QUERY); ResultSet rs = s.executeQuery(); while (rs.next()) { //get the details from the database System.out.println("COLUMN VALUE"+rs.getString(COLUMNNAME)); }
Steps for Creating DataSource for Microsoft Access drivers |
---|
1.Go to Control Panel and Select Administrative Tools and then select Data Source ODBC icon. |
(or) |
1.Go to Run(Press Window+R) and type odbcad32.exe to go Data Source ODBC. |
2.Press Add Button. |
3.Choose the driver for Microsoft Access. |
4.Then,Press Finish Button. |
5.Type Data Source Name. |
6.Then Press "Select Button" and choose the database file which is created already. |
7.Then, Press "OK" Button to complete the process. |