List of usage examples for java.lang ClassNotFoundException getMessage
public String getMessage()
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccDb2LUW.CFAccDb2LUWSchema.java
public boolean connect() { final String S_ProcName = "connect"; if (cnx != null) { return (false); }//from w w w .j a v a 2s . co m if (configuration != null) { try { Class.forName("com.ibm.db2.jcc.DB2Driver"); } catch (ClassNotFoundException e) { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), "connect", "Could not load IBM DB/2 LUW 10.5 driver", e); } String dbServer = configuration.getDbServer(); int dbPort = configuration.getDbPort(); String dbDatabase = configuration.getDbDatabase(); String dbUserName = configuration.getDbUserName(); String dbPassword = configuration.getDbPassword(); String url = "jdbc:db2://" + dbServer + ":" + Integer.toString(dbPort) + "/" + dbDatabase; Properties props = new Properties(); props.setProperty("user", dbUserName); props.setProperty("password", dbPassword); try { cnx = DriverManager.getConnection(url, props); cnx.setAutoCommit(false); cnx.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ); cnx.rollback(); setSchemaDbName(dbDatabase); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } return (true); } if (jndiName != null) { try { Context ctx = new InitialContext(); DataSource ds = (DataSource) ctx.lookup(jndiName); if (ds == null) { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Could not get resolve DataSource \"" + jndiName + "\""); } cnx = ds.getConnection(); if (cnx == null) { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Could not get Connection from DataSource \"" + jndiName + "\""); } cnx.setAutoCommit(false); cnx.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ); cnx.rollback(); } catch (NamingException e) { cnx = null; throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "NamingException " + e.getMessage(), e); } catch (SQLException e) { cnx = null; inTransaction = false; throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } return (true); } throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Neither configurationFile nor jndiName found, do not know how to connect to database"); }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstMySql.CFAstMySqlSchema.java
public boolean connect() { final String S_ProcName = "connect"; if (cnx != null) { return (false); }/*from w w w.j av a2s .com*/ if (configuration != null) { try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException e) { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), "connect", "Could not load MySql 5.5 JDBC driver", e); } String dbServer = configuration.getDbServer(); int dbPort = configuration.getDbPort(); String dbDatabase = configuration.getDbDatabase(); String dbUserName = configuration.getDbUserName(); String dbPassword = configuration.getDbPassword(); String url = "jdbc:mysql://" + dbServer + ":" + Integer.toString(dbPort) + "/" + dbDatabase; Properties props = new Properties(); props.setProperty("user", dbUserName); props.setProperty("password", dbPassword); try { cnx = DriverManager.getConnection(url, props); cnx.setAutoCommit(false); cnx.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ); cnx.rollback(); setDbSchemaName(dbDatabase); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } return (true); } if (jndiName != null) { try { Context ctx = new InitialContext(); DataSource ds = (DataSource) ctx.lookup(jndiName); if (ds == null) { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Could not get resolve DataSource \"" + jndiName + "\""); } cnx = ds.getConnection(); if (cnx == null) { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Could not get Connection from PooledConnection for ConnectionPoolDataSource \"" + jndiName + "\""); } cnx.setAutoCommit(false); cnx.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ); cnx.rollback(); } catch (NamingException e) { cnx = null; throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "NamingException " + e.getMessage(), e); } catch (SQLException e) { cnx = null; inTransaction = false; throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } return (true); } throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Neither configurationFile nor jndiName found, do not know how to connect to database"); }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccMySql.CFAccMySqlSchema.java
public boolean connect() { final String S_ProcName = "connect"; if (cnx != null) { return (false); }//from w w w .ja va2 s . com if (configuration != null) { try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException e) { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), "connect", "Could not load MySql 5.5 JDBC driver", e); } String dbServer = configuration.getDbServer(); int dbPort = configuration.getDbPort(); String dbDatabase = configuration.getDbDatabase(); String dbUserName = configuration.getDbUserName(); String dbPassword = configuration.getDbPassword(); String url = "jdbc:mysql://" + dbServer + ":" + Integer.toString(dbPort) + "/" + dbDatabase; Properties props = new Properties(); props.setProperty("user", dbUserName); props.setProperty("password", dbPassword); try { cnx = DriverManager.getConnection(url, props); cnx.setAutoCommit(false); cnx.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ); cnx.rollback(); setSchemaDbName(dbDatabase); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } return (true); } if (jndiName != null) { try { Context ctx = new InitialContext(); DataSource ds = (DataSource) ctx.lookup(jndiName); if (ds == null) { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Could not get resolve DataSource \"" + jndiName + "\""); } cnx = ds.getConnection(); if (cnx == null) { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Could not get Connection from DataSource \"" + jndiName + "\""); } cnx.setAutoCommit(false); cnx.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ); cnx.rollback(); } catch (NamingException e) { cnx = null; throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "NamingException " + e.getMessage(), e); } catch (SQLException e) { cnx = null; inTransaction = false; throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } return (true); } throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Neither configurationFile nor jndiName found, do not know how to connect to database"); }
From source file:Sales.TabbedPaneWin.java
private void removeBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeBtnActionPerformed if (Validate.isValidClientId(clientIdTxtF2.getText())) { try {//from ww w .jav a 2 s . co m String ClientID = clientIdTxtF2.getText(); OOClient.setCLIENTID(ClientID); if (OOClient.delete()) {//row count (0,1,2..) or (0) for nothing jTable3.setModel(DbUtils.resultSetToTableModel(refreshTableClient())); JOptionPane.showMessageDialog(null, "ID " + ClientID + " deletion Successfull"); resetClientFields(); } else { JOptionPane.showMessageDialog(null, "Error: ClientID not found.."); } } catch (ClassNotFoundException ex) { Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);//Logiing errors System.err.println(ex.getMessage()); JOptionPane.showMessageDialog(null, ex.getMessage(), "Unkown Error", JOptionPane.ERROR_MESSAGE);//if needed show in clients interface } catch (Exception ex) { Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex); } } else { jLabel18.setVisible(true); JOptionPane.showMessageDialog(null, "Enter ClientID in given form..."); } jLabel18.setVisible(false); }
From source file:Sales.TabbedPaneWin.java
private void tableSearchField1KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_tableSearchField1KeyReleased String searchField = tableSearchField1.getText(); if (searchField.startsWith("C")) {//client id side try {/*from www . j a v a 2 s . c o m*/ OOClient.setCLIENTID(searchField); jTable3.setModel(DbUtils.resultSetToTableModel(OOClient.searchTableClientId())); } catch (ClassNotFoundException ex) { Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);//Logiing errors System.err.println(ex.getMessage()); JOptionPane.showMessageDialog(null, ex.getMessage(), "Unknown Error", JOptionPane.ERROR_MESSAGE); } catch (Exception ex) { Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex); } } else { //client Nmae try { OOClient.setNAME(searchField); jTable3.setModel(DbUtils.resultSetToTableModel(searchTableClientName())); } catch (ClassNotFoundException ex) { Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);//Logiing errors System.err.println(ex.getMessage()); JOptionPane.showMessageDialog(null, ex.getMessage(), "Unknown Error", JOptionPane.ERROR_MESSAGE); } catch (Exception ex) { Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex); } } if (searchField.isEmpty()) { try { jTable3.setModel(DbUtils.resultSetToTableModel(refreshTableClient())); } catch (ClassNotFoundException ex) { Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex); } catch (Exception ex) { Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex); } } }
From source file:Sales.TabbedPaneWin.java
private void searchTxtFKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_searchTxtFKeyReleased String searchField = searchTxtF.getText(); if (searchField.startsWith("I")) {//client id side try {/* www . j av a2 s .co m*/ String arr[] = { searchField }; OOInvoice.setITEMCODE(arr); selectItemsTable.setModel(DbUtils.resultSetToTableModel(OOInvoice.searchTableItemCode())); } catch (ClassNotFoundException ex) { Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);//Logiing errors System.err.println(ex.getMessage()); JOptionPane.showMessageDialog(null, ex.getMessage(), "Unknown Error", JOptionPane.ERROR_MESSAGE); } catch (Exception ex) { Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex); } } else { //client Nmae try { OOInvoice.setITEMNAME(searchField); selectItemsTable.setModel(DbUtils.resultSetToTableModel(searchTableItemName())); } catch (ClassNotFoundException ex) { Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);//Logiing errors System.err.println(ex.getMessage()); JOptionPane.showMessageDialog(null, ex.getMessage(), "Unknown Error", JOptionPane.ERROR_MESSAGE); } catch (Exception ex) { Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex); } } if (searchField.isEmpty()) { try { selectItemsTable.setModel(DbUtils.resultSetToTableModel(OOInvoice.refreshTableInvoice())); } catch (ClassNotFoundException ex) { Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex); } catch (Exception ex) { Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex); } } }
From source file:Sales.TabbedPaneWin.java
private void addAgreementBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addAgreementBtnActionPerformed ListModel lModel = jList1.getModel(); String[] arr = new String[lModel.getSize()]; if (Validate.isValidClientId(clientIdTxtF4.getText())) { if (Validate.isValidAgreementId(agreementIdTxtF1.getText())) { if (true) { if (true) { try { OOAgreement.setAGREEMENTID(agreementIdTxtF1.getText()); OOAgreement.setCLIENTID(clientIdTxtF4.getText()); OOAgreement.setFROM( ((JTextField) fromDateChooser.getDateEditor().getUiComponent()).getText());//downcasting UI-> hierachy OOAgreement/* w w w.java 2 s . com*/ .setTO(((JTextField) toDateChooser.getDateEditor().getUiComponent()).getText()); OOAgreement.setTYPE(agTypeComboBox.getSelectedItem().toString()); for (int i = 0; i < lModel.getSize(); i++) { arr[i] = (String) lModel.getElementAt(i); } OOAgreement.setASESTS(arr); //insert if (OOAgreement.insert(lModel.getSize())) {//row count (0,1,2..) or (0) for nothing,,,,,,Getting model size and passing to insert model for futher op JOptionPane.showMessageDialog(null, "Adding Agreement Successfull"); jTable1.setModel(DbUtils.resultSetToTableModel(dispalyTableExpiary())); resetAgreementFields(); } else { JOptionPane.showMessageDialog(null, "Error: Use existing ClientID.."); } } catch (ClassNotFoundException ex) { Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);//Logiing errors System.err.println(ex.getMessage()); JOptionPane.showMessageDialog(null, ex.getMessage(), "Unkown Error", JOptionPane.ERROR_MESSAGE);//if needed show in clients interface } catch (Exception ex) { Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex); } } else { jLabel67.setVisible(true); JOptionPane.showMessageDialog(null, "Enter valid Renew Date ..."); } } else { jLabel75.setVisible(true); JOptionPane.showMessageDialog(null, "Enter valid current Date or Reset ..."); } } else { jLabel71.setVisible(true); JOptionPane.showMessageDialog(null, "Enter AgreeementId in given form..."); } } else { jLabel76.setVisible(true); JOptionPane.showMessageDialog(null, "Enter ClientID in given form..."); } jLabel71.setVisible(false); jLabel74.setVisible(false); jLabel75.setVisible(false); jLabel67.setVisible(false); jLabel76.setVisible(false); }
From source file:Sales.TabbedPaneWin.java
private void registerBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_registerBtnActionPerformed //Getting/*from w w w. j a v a 2s. c om*/ if (Validate.isValidClientId(clientIdTxtF2.getText())) { if (Validate.isValidPhone(mobileTxtF.getText())) { if (Validate.isValidPhone(telephoneTxtF.getText())) { if (Validate.isValidPhone(faxTxtF.getText())) { if (Validate.isValidEmailAddress(emailTxtF.getText())) { if (Validate.isValidCordinatorId(coIdF.getText())) { if (Validate.isValidPhone(coMobileTxtF.getText())) { if (Validate.isValidEmailAddress(coEmailTxtF.getText())) { OOClient.setADDRESS(addrTxtF.getText()); OOClient.setCEMAIL(coEmailTxtF.getText()); OOClient.setCLIENTID(clientIdTxtF2.getText()); OOClient.setCMOBILE(coMobileTxtF.getText()); OOClient.setCNAME(coNameTxtF.getText()); OOClient.setEMAIL(emailTxtF.getText()); OOClient.setFAX(faxTxtF.getText()); OOClient.setMOBILE(mobileTxtF.getText()); OOClient.setNAME(nameTxtF.getText()); OOClient.setTELEPHONE(telephoneTxtF.getText()); OOClient.setCOID(coIdF.getText()); try { //insert if (OOClient.insert()) {//row count (0,1,2..) or (0) for nothing jTable3.setModel( DbUtils.resultSetToTableModel(refreshTableClient())); JOptionPane.showMessageDialog(null, "Client Registraion Successfull"); resetClientFields(); } else { JOptionPane.showMessageDialog(null, "Error: Hit reset and try again.."); } } catch (ClassNotFoundException ex) { Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);//Logiing errors System.err.println(ex.getMessage()); JOptionPane.showMessageDialog(null, ex.getMessage(), "Unkown Error", JOptionPane.ERROR_MESSAGE);//if needed show in clients interface } catch (Exception ex) { Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex); } } else { jLabel72.setVisible(true); JOptionPane.showMessageDialog(null, "Enter valid Cordinator email..."); } } else { jLabel73.setVisible(true); JOptionPane.showMessageDialog(null, "Enter valid Cordinator Mobile ..."); } } else { jLabel70.setVisible(true); JOptionPane.showMessageDialog(null, "Enter Exsisting CordinatorId ..."); } } else { jLabel45.setVisible(true); JOptionPane.showMessageDialog(null, "Enter valid email ..."); } } else { jLabel44.setVisible(true); JOptionPane.showMessageDialog(null, "Enter valid fax ..."); } } else { jLabel1.setVisible(true); JOptionPane.showMessageDialog(null, "Enter valid telephone ..."); } } else { jLabel43.setVisible(true); JOptionPane.showMessageDialog(null, "Enter valid mobile ..."); } } else { jLabel18.setVisible(true); JOptionPane.showMessageDialog(null, "Enter ClientID in given form..."); } jLabel45.setVisible(false); jLabel70.setVisible(false); jLabel73.setVisible(false); jLabel72.setVisible(false); jLabel18.setVisible(false); jLabel43.setVisible(false); jLabel1.setVisible(false); jLabel44.setVisible(false); }
From source file:Sales.TabbedPaneWin.java
private void modifyRecBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_modifyRecBtnActionPerformed if (Validate.isValidClientId(clientIdTxtF2.getText())) { if (Validate.isValidPhone(mobileTxtF.getText())) { if (Validate.isValidPhone(telephoneTxtF.getText())) { if (Validate.isValidPhone(faxTxtF.getText())) { if (Validate.isValidEmailAddress(emailTxtF.getText())) { if (Validate.isValidCordinatorId(coIdF.getText())) { if (Validate.isValidPhone(coMobileTxtF.getText())) { if (Validate.isValidEmailAddress(coEmailTxtF.getText())) { try { //Getting OOClient.setADDRESS(addrTxtF.getText()); OOClient.setCEMAIL(coEmailTxtF.getText()); OOClient.setCLIENTID(clientIdTxtF2.getText()); OOClient.setCMOBILE(coMobileTxtF.getText()); OOClient.setCNAME(coNameTxtF.getText()); OOClient.setEMAIL(emailTxtF.getText()); OOClient.setFAX(faxTxtF.getText()); OOClient.setMOBILE(mobileTxtF.getText()); OOClient.setNAME(nameTxtF.getText()); OOClient.setTELEPHONE(telephoneTxtF.getText()); OOClient.setCOID(coIdF.getText()); if (OOClient.update()) {//row count (0,1,2..) or (0) for nothing jTable3.setModel( DbUtils.resultSetToTableModel(refreshTableClient())); JOptionPane.showMessageDialog(null, "Record Updation Successfull"); resetClientFields(); } else { JOptionPane.showMessageDialog(null, "Error: ClientID not found.."); } } catch (ClassNotFoundException ex) { Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex);//Logiing errors System.err.println(ex.getMessage()); JOptionPane.showMessageDialog(null, ex.getMessage(), "Unkown Error", JOptionPane.ERROR_MESSAGE);//if needed show in clients interface } catch (Exception ex) { Logger.getLogger(TabbedPaneWin.class.getName()).log(Level.SEVERE, null, ex); }//w ww . java2s. com } else { jLabel72.setVisible(true); JOptionPane.showMessageDialog(null, "Enter valid Cordinator email..."); } } else { jLabel73.setVisible(true); JOptionPane.showMessageDialog(null, "Enter valid Cordinator Mobile ..."); } } else { jLabel70.setVisible(true); JOptionPane.showMessageDialog(null, "Enter Exsisting CordinatorId ..."); } } else { jLabel45.setVisible(true); JOptionPane.showMessageDialog(null, "Enter valid email ..."); } } else { jLabel44.setVisible(true); JOptionPane.showMessageDialog(null, "Enter valid fax ..."); } } else { jLabel1.setVisible(true); JOptionPane.showMessageDialog(null, "Enter valid telephone ..."); } } else { jLabel43.setVisible(true); JOptionPane.showMessageDialog(null, "Enter valid mobile ..."); } } else { jLabel18.setVisible(true); JOptionPane.showMessageDialog(null, "Enter ClientID in given form..."); } jLabel45.setVisible(false); jLabel70.setVisible(false); jLabel73.setVisible(false); jLabel72.setVisible(false); jLabel18.setVisible(false); jLabel43.setVisible(false); jLabel1.setVisible(false); jLabel44.setVisible(false); }
From source file:rems.Global.java
public static void runReport(String outputUsd, String outfileName, String jsprReportPath, String reportTitle, String rptSQL) {/* ww w. ja v a2s . c om*/ try { //Compile jrxml file. System.out.println("Inside Jasper:" + jsprReportPath); Global.updateLogMsg(Global.logMsgID, "\r\nInside Jasper:" + jsprReportPath, Global.logTbl, Global.gnrlDateStr, Global.rnUser_ID); //System.in.read(); String orgNm = Global.getOrgName(Global.UsrsOrg_ID).replace("\r\n", " ").replace("\r", " ") .replace("\n", " "); String pstl = Global.getOrgPstlAddrs(Global.UsrsOrg_ID).replace("\r\n", " ").replace("\r", " ") .replace("\n", " "); //Contacts Nos String cntcts = Global.getOrgContactNos(Global.UsrsOrg_ID).replace("\r\n", " ").replace("\r", " ") .replace("\n", " "); //Email Address String email = Global.getOrgEmailAddrs(Global.UsrsOrg_ID).replace("\r\n", " ").replace("\r", " ") .replace("\n", " "); String website = Global.getOrgWebsite(Global.UsrsOrg_ID).replace("\r\n", " ").replace("\r", " ") .replace("\n", " "); String online = ""; if (!email.trim().equals("")) { online += "Email: " + email; if (!website.equals("")) { online += " Website: " + website; } } String fileName = jsprReportPath; File theFile = new File(fileName); JasperDesign jasperDesign = JRXmlLoader.load(theFile); //Build a new query //rptSQL String theQuery = rptSQL; //System.out.println(rptSQL); // update the data query JRDesignQuery newQuery = new JRDesignQuery(); newQuery.setText(theQuery); jasperDesign.setQuery(newQuery); JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign); System.out.println("Compiled Successfully"); Global.updateLogMsg(Global.logMsgID, "\r\nCompiled Successfully", Global.logTbl, Global.gnrlDateStr, Global.rnUser_ID); //JasperReport jasperReport = JasperCompileManager.compileReport(reportPath); Map<String, Object> params = new HashMap<String, Object>(); params.put("P_ImageUrl", Global.getOrgImgsDrctry() + "/" + String.valueOf(Global.UsrsOrg_ID) + ".png"); params.put("P_ReportTitle", reportTitle); params.put("P_OrgName", orgNm); params.put("P_OrgAddress", pstl); params.put("P_ContactInfo", cntcts); params.put("P_WebEmail", online); Connection connection; Class.forName("org.postgresql.Driver"); connection = DriverManager.getConnection( "jdbc:postgresql://" + Global.Hostnme + ":" + Global.Portnum + "/" + Global.Dbase, Global.Uname, Global.Pswd); System.out.println("Filling report..."); Global.updateLogMsg(Global.logMsgID, "\r\nFilling report...", Global.logTbl, Global.gnrlDateStr, Global.rnUser_ID); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, params, connection); if (outputUsd.equals("MICROSOFT EXCEL")) { JRXlsExporter xlsExporter = new JRXlsExporter(); xlsExporter.setExporterInput(new SimpleExporterInput(jasperPrint)); xlsExporter.setExporterOutput(new SimpleOutputStreamExporterOutput(outfileName)); SimpleXlsReportConfiguration xlsReportConfiguration = new SimpleXlsReportConfiguration(); //SimpleXlsExporterConfiguration xlsExporterConfiguration = new SimpleXlsExporterConfiguration(); xlsReportConfiguration.setOnePagePerSheet(false); xlsReportConfiguration.setRemoveEmptySpaceBetweenRows(true); xlsReportConfiguration.setDetectCellType(true); xlsReportConfiguration.setWhitePageBackground(false); xlsExporter.setConfiguration(xlsReportConfiguration); xlsExporter.exportReport(); } else if (outputUsd.equals("PDF")) { JasperExportManager.exportReportToPdfFile(jasperPrint, outfileName); } else if (outputUsd.equals("HTML")) { JasperExportManager.exportReportToHtmlFile(jasperPrint, outfileName); } else if (outputUsd.equals("STANDARD")) { JasperExportManager.exportReportToPdfFile(jasperPrint, outfileName); } else if (outputUsd.equals("MICROSOFT WORD")) { JRRtfExporter rtfExporter = new JRRtfExporter(); rtfExporter.setExporterInput(new SimpleExporterInput(jasperPrint)); rtfExporter.setExporterOutput(new SimpleWriterExporterOutput(outfileName)); SimpleRtfReportConfiguration rtfReportConfiguration = new SimpleRtfReportConfiguration(); //SimpleRtfExporterConfiguration xlsExporterConfiguration = new SimpleRtfExporterConfiguration(); rtfExporter.setConfiguration(rtfReportConfiguration); rtfExporter.exportReport(); } else if (outputUsd.equals("CHARACTER SEPARATED FILE (CSV)")) { JRCsvExporter exporter = new JRCsvExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); exporter.setExporterOutput(new SimpleWriterExporterOutput(outfileName)); SimpleCsvReportConfiguration rtfReportConfiguration = new SimpleCsvReportConfiguration(); //SimpleCsvExporterConfiguration xlsExporterConfiguration = new SimpleCsvExporterConfiguration(); exporter.setConfiguration(rtfReportConfiguration); exporter.exportReport(); } else { JasperExportManager.exportReportToPdfFile(jasperPrint, outfileName); } //JasperViewer.viewReport(jasperPrint, false); // if (Desktop.isDesktopSupported() && Global.callngAppType.equals("DESKTOP")) { // try { // File myFile = new File(outfileName); // Desktop.getDesktop().open(myFile); // } catch (IOException ex) { // // no application registered for PDFs // } // } // Runtime runTime = Runtime.getRuntime(); // Process process = runTime // .exec("C:/Users/richard.adjei-mensah/Desktop/Test1.pdf"); // // System.out.println("Closing report"); // process.destroy(); connection.close(); } catch (JRException ex) { System.out.println(ex.getMessage()); Global.errorLog += ex.getMessage() + System.getProperty("line.separator") + ex.toString() + Arrays.toString(ex.getStackTrace()); Global.writeToLog(); Global.updateLogMsg(Global.logMsgID, "\r\n\r\n\r\nLog Messages ==>\r\n\r\n" + Global.errorLog, Global.logTbl, Global.gnrlDateStr, Global.rnUser_ID); } catch (ClassNotFoundException e) { System.out.println(e.getMessage()); Global.errorLog += e.getMessage() + System.getProperty("line.separator") + Arrays.toString(e.getStackTrace()); Global.writeToLog(); Global.updateLogMsg(Global.logMsgID, "\r\n\r\n\r\nLog Messages ==>\r\n\r\n" + Global.errorLog, Global.logTbl, Global.gnrlDateStr, Global.rnUser_ID); } catch (SQLException e) { System.out.println(e.getMessage()); Global.errorLog += e.getMessage() + System.getProperty("line.separator") + Arrays.toString(e.getStackTrace()); Global.writeToLog(); Global.updateLogMsg(Global.logMsgID, "\r\n\r\n\r\nLog Messages ==>\r\n\r\n" + Global.errorLog, Global.logTbl, Global.gnrlDateStr, Global.rnUser_ID); } catch (Exception ex) { System.out.println(ex.getMessage()); Global.errorLog += ex.getMessage() + System.getProperty("line.separator") + Arrays.toString(ex.getStackTrace()); Global.writeToLog(); Global.updateLogMsg(Global.logMsgID, "\r\n\r\n\r\nLog Messages ==>\r\n\r\n" + Global.errorLog, Global.logTbl, Global.gnrlDateStr, Global.rnUser_ID); } finally { //System.out.println(ex.getMessage()); //Global.errorLog += ex.getMessage(); Global.writeToLog(); Global.updateLogMsg(Global.logMsgID, "\r\n\r\n\r\nLog Messages ==>\r\n\r\n" + Global.errorLog, Global.logTbl, Global.gnrlDateStr, Global.rnUser_ID); } try { Thread.sleep(5000); } catch (InterruptedException e) { System.out.println(e.getMessage()); Global.errorLog += e.getMessage() + System.getProperty("line.separator") + Arrays.toString(e.getStackTrace()); Global.writeToLog(); Global.updateLogMsg(Global.logMsgID, "\r\n\r\n\r\nLog Messages ==>\r\n\r\n" + Global.errorLog, Global.logTbl, Global.gnrlDateStr, Global.rnUser_ID); } }