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.
I have a class(DatabaseConnection.java) which has methods which do database stuff(loading database driver, creating connection to the database and executing some queries).
I am using MS access database and the datasource is created properly. "sun.jdbc.odbc.JdbcOdbcDriver" is the driver.
The problem is when i use the class from any servlet to get the connection to the datasource, the connection object is returned as null. But when i put a static main method in the same class and try to access the database, it works fine.
I could not find the reason and i could not get any help.