Hi,
I have installed tomcat5.5 and jdk1.6 on my machine which has Windows
server2003 as OS.
I'm not able to clearly underdstand the steps in tomcat docs (JNDI
resources/ JDBC resources to be used for db access) for connecting to
database and the changes to be made in different files.
Can someone tell me detailed and clear steps for connecting to an ms
access database through jsp using ODBC bridge?
Thanks in advance for your suggestions.
Let me start by saying that building enterprise software on top of MS
Access is a BAD idea, it's better to use a "grown up" database such as
MS SQL, Oracle, MySQL. These databases all have native JDBC drivers,
instead of using the ODBC bridge. MySQL is a free database and MS SQL
2005 Express as well, so costs should not be a factor.
I doubt that there is solid JDBC 2 driver capabilities in the JDBC-
ODBC bridge, if any. For use in Tomcat, you would want to make use of
the javax.sql.DataSource interface in concert with JNDI. Use Netbeans
or some other IDE to check that the sun.jdbc.odbc.JdbcOdbcDriver class
implements the javax.sql.DataSource interface. If it doesn't, I don't
think you can use JNDI, connection pooling, etc. that Tomcat would
otherwise take care of for you.You'd have to use the old style
DriverManager in your code.
If JdbcOdbcDriver supports DataSource, create a new SQL datasource
pointing to your database - there is a step-by-step instruction in the
manual on how in jndi-resources-howto.html, "JDBC Data Sources". Step
2 will be the same, assuming you want to refer to your data as
"EmployeeDB". Step 4 will need to reflect that you are using the ODBC
bridge rather than the Hypersonic driver. Use
driverClassName="sun.jdbc.odbc.JdbcOdbcDriver" and
url="jdbc

dbc:yourdsn" where yourdsn is the dsn name pointing to your
access database.
Again, I don't think this would work with the ODBC bridge, but even if
it did, I would recommend against it. Access is for storing personal
CD collections, not for real-world applications.