This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Environment: Created an struts application connected to MS Access. The conection created through JDBC-ODBC bridge using the Class for name (classes12.zip driver) in java.
Issue: We are able to access the database through struts form the first time through JSP, however once we refresh or request the same page again, it creates the connection but cannot create the statement ie. the error comes at point stmt =con.createStatement();
We have checked the program works if we call the method from normal jsp-java rather than struts framework. What settings are misisng?
1. Classes12.zip is the Oracle JDBC driver; not sure where it fits in. I will assume you're actually not using this at all.
2. You give neither the precise error you get nor a stack trace. Without that, we're flying blind.
3. It is unlikely to have anything to do with Struts as such; Struts doesn't touch the database. If you're using the DataSource that Struts can give you, but are not using a DataSource in your JSPs, that might well be the difference. Are you sure you are closing your ResultSets and Statements before you close the connection (i.e. return it to the pool)?
4. The JDBC-ODBC bridge has some pretty serious restrictions and is not supported for production purposes. One restriction I know of is that you cannot have more than one result set open on a single connection. I'm not aware of a restriction on the number of statements.
5. Access is not generally considered fit for this purpose. It may well bring restrictions of its own, but I'm not familiar enough with it to say.
If I were in your shoes I'd try to get away from both Access and the JDBC-ODBC bridge.