This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi All, One of the existing application which is used over a period of time causing a problem all of sudden. When investigated i found the Statment object is not returned from the Connection object. System.out.println("Connection is closed " +conn.isClosed() ); //isClosed() is returing false, which making me to belive connection is fine. Statement st =conn.createStatement(); //st is null
What whould be possible reason createStatement method return null... Thanks in advence for help....
System.out.println("Connection is closed " +conn.isClosed() ); //isClosed() is returing false, which making me to belive connection is fine
Instead of this one check out if (conn == null) if yes then conenction might not have established.
As per my knowledge u might not get the statement object because the connection object is not obtained,you can try out the check for connection object like above mentioned ie for null.
The Art Of Life Is To Know When To Be Useless And When To Be Useful - CHUANG TZU
Joined: Nov 28, 2001
Hi Jignesh, Actually if connection was null, then when i tried createStatement() on connection object i should have got null pointer exception. However i tried your condition and i found that connection is not null. Any other inputs.... Thanks
Joined: Dec 28, 2004
If u can , please paste some of ur code which is creating problem?? By looking at the code somebody can help u in less time.
Please specify the problem enviornment clearly. Like which database, driver, App Server etc u are using .. Becuase there may be some problem in the enviorment. Also paste some code snipplet you are trying out..
Joined: Nov 28, 2001
Hi Guys, Thanks for your response. The problem is resolved, The cause for the problem was the classpath. I mean the driver present in the classpath was not one expected. Hence on correcting the classpath, application is working fine. Regards Arun