Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
usha mocherla
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic