Himanshu Walia - 2009-08-01

hi all

i have used the below code  in my Compiere Application for printing IReport.

Its working fine for first 4 or 5 prints , but after that , if i click Print Button ....my   application  goes into hange state and  Database Connection get Lost  resulting in throwing @NoDBConnection@ exception .

i tried relpacing my Database to Oracle 10 G  from Oracle Xe  edition , but Stil the same  problem persists .

this problem only coming in case of jasper ireport Prnting , other wise Application is running fine with perfect Database Conncetivity .

Please Suggest the possible way out to this problem ?

is Something went wrong in my code ? or some other problem ?

With Regards

Himanshu Walia

protected String doIt() throws Exception {
path =getpath.path("Jasper.properties");
     str = Getpath.ReadProp(path, "Okaya.jasper");
      t.put("C_ORDER_ID", c_order_id);
     JasperPrint prnt = JasperFillManager.fillReport(str, t, CConnection.get().createConnection(false, 8));

JRViewerProvider viewerLauncher = ReportStarter.getReportViewerProvider();

   viewerLauncher.openViewer(prnt, "Dispatch Advice");          
    }

Full Exception trace after 4-5 Prints

-----------> DB.dumpBorrowers: Connection[0]=oracle.jdbc.driver.LogicalConnection@bb6d85 borrowed from:  [13]
java.lang.Throwable
    at org.compiere.util.DB.getCachedConnection(DB.java:1825)
    at org.compiere.util.Trx.<init>(Trx.java:66)
    at org.compiere.util.Trx.get(Trx.java:46)
    at org.compiere.process.SvrProcess.startProcess(SvrProcess.java:87)
    at org.compiere.apps.ProcessCtl.startProcess(ProcessCtl.java:488)
    at org.compiere.apps.ProcessCtl.run(ProcessCtl.java:256)

-----------> DB.dumpBorrowers: Connections remaining: 1 [13]
-----------> iR_Okaya.startProcess: DB.getCachedConnection() - @NoDBConnection@ [13]
java.lang.UnsupportedOperationException: DB.getCachedConnection() - @NoDBConnection@
    at org.compiere.util.DB.getCachedConnection(DB.java:1828)
    at org.compiere.util.CPreparedStatement.<init>(CPreparedStatement.java:82)
    at org.compiere.util.DB.executeUpdate(DB.java:577)
    at org.compiere.util.DB.executeUpdate(DB.java:502)
    at org.compiere.process.SvrProcess.lock(SvrProcess.java:408)
    at org.compiere.process.SvrProcess.startProcess(SvrProcess.java:93)
    at org.compiere.apps.ProcessCtl.startProcess(ProcessCtl.java:488)
    at org.compiere.apps.ProcessCtl.run(ProcessCtl.java:256)