This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Struts and the fly likes server goes into sleep state while executing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "server goes into sleep state while executing "Connection con=datasource.getConnection" Watch "server goes into sleep state while executing "Connection con=datasource.getConnection" New topic
Author

server goes into sleep state while executing "Connection con=datasource.getConnection

usha mocherla
Ranch Hand

Joined: Sep 24, 2004
Posts: 33
This is my code ,i m trying to run:
try {
System.out.println("IN TRY"+sys.getSysname());
System.out.println("AFTER TRY DATASOURCE"+datasource);
con=datasource.getConnection();

System.out.println("ADDDDDSYS DETAILSppppppp"+sys.getSysname());
stm=con.createStatement();

StringBuffer sql=new StringBuffer("insert into employeesystem ");
sql.append("values('"+sys.getEmpId() +"', ");
sql.append("'"+sys.getSysname() +"', ");
sql.append("'"+sys.getIpaddress() +"', ");
sql.append("'"+sys.getAllocateddate() +"' , ");
sql.append("'"+sys.getReturndate() +"', ");
sql.append("'"+sys.getLocation() +"', ");
sql.append("'"+sys.getKeyboard() +"', ");
sql.append("'"+sys.getMouse() +"', ");
sql.append("'"+sys.getFloppy() +"', ");
sql.append("'"+sys.getCdrome() +"', ");
sql.append("'"+sys.getCdWriter() +"', ");
sql.append("'"+sys.getMultimedia() +"', ");
sql.append("'"+sys.getProcessor() +"', ");
sql.append("'"+sys.getMotherboard() +"', ");
sql.append("'"+sys.getRam() +"' , ");
sql.append("'"+sys.getHarddisk()+"')");
System.out.println("ADDSYS QUERY@@@@@@@ "+sql.toString());
stm.executeUpdate(sql.toString());}


But in the try block,after executing first and secon System.out.println("IN TRY"); and System.out.println("AFTER TRY DATASOURCE");,
the server,Tomcat server,is going in the sleep state and on my console,i 'll get "Sleep until next",continuosly.
I 've to stop the tomcat in between.

The program is not running after the second print statement.
It is not even throwing any exception also.
Plz help me in recovering this error.

Thanx in advance.
regards
John Smith
Ranch Hand

Joined: Sep 02, 2004
Posts: 61
That code looks harmless enough, I'd be looking for something wrong in your context.xml (and maybe web.xml although less likely) with the way you're declaring the datasource driver and such
usha mocherla
Ranch Hand

Joined: Sep 24, 2004
Posts: 33
thanx
i got it.it was in struts-config,where i had to mention the max count and min count in the data sources.
regards
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: server goes into sleep state while executing "Connection con=datasource.getConnection