Use JDBC-ODBC to connect Access files directly
For settings with the JSP server under Windows, use Access is a better choice, but you should usually pass the data source using the Access database. Here is a method that does not directly connect the data source for Java using a data source. The example program is as follows:
Import java.sql. *;
Public Class Access
{
Public static void main (string args [])
{
Try
{
Strull = "JDBC: ODBC: driver = {Microsoft Access Driver (* .mdb)}; DBQ = BOOKS.MDB";
Class.Forname ("Sun.jdbc.odbc.jdbcodbcdriver");
Connection conn = drivermanager.getConnection (StrURL);
Statement Stmt = conn.createstatement ();
ResultSet RS = Stmt.executeQuery ("SELECT * from Books");
IF (rs.next ())
{
System.out.println (Rs.getstring ("Introduction"));
}
} catch (Exception E)
{
System.out.println (e);
}
}
}
You can see that you can also use the data source as long as the ODBC driver is added later, this method should also apply to other small databases (such as forpro).