No error but still nothing is enter into my Excel file

this is my connection class and i enter paramters into the logPayment method ...... Im getting NO ERRO message by still no data is entered into my excel worksheet ..... and my parameters all have values in them ..... none are empty
Can anyone help me please
here is my code
import java.io.*;
import java.sql.*;
import java.util.*;
import javax.swing.*;
import java.awt.*;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.GregorianCalendar;
import java.util.Date;
import java.util.Date.*;
import java.util.Calendar;
* The class which provides the link between the user interface and the spreadsheet.
* @author John (Sean) Gleeson #100437719.
class JDBCConnExcel
    * Creates the class, i.e initalises the mysql driver,
    * and sets up the connection to the database.
   public JDBCConnExcel()
      try
         // Initialise drivers
         Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
      catch(Exception e)
         System.out.println("Failed to load JDBC/Excel driver.");
      //Setup connection to database
      try
         //Make connection to database
         connectionObject = DriverManager.getConnection (ODBC, username, password);
         // Setup statement stream
         statementObject= connectionObject.createStatement();
      catch(SQLException sqle)
              String msg = getClass().getName() + ".method() : An exception of type " + sqle.getClass().getName() + " was thrown with the following message [" + sqle.getMessage() + "]" ;
              System.out.println(msg) ;
    ***************************getters***********************************
   public void logPayment(String mastID, String name, String address,
      String town, String county, double amount)
      PreparedStatement aPreparedStatement = null;
      File inputFile = null;
      Connection con = null;
      DatabaseMetaData dmd = null;
      try
        inputFile = new File("payment.xls");
     System.out.println("AutoCommit:"+connectionObject.getAutoCommit());
     dmd = connectionObject.getMetaData();
     System.out.println("MaxConnections:"+dmd.getMaxConnections());
     System.out.println("PositionedUpdate:"+dmd.supportsPositionedUpdate());
     System.out.println("SelectForUpdate:"+dmd.supportsSelectForUpdate());
     System.out.println("StoredProcedures:"+dmd.supportsStoredProcedures());
     System.out.println("Transactions:"+dmd.supportsTransactions());
     dmd = null;
        System.err.println("Readonly = " + connectionObject.isReadOnly());
     aPreparedStatement = connectionObject.prepareStatement ( "INSERT INTO [Receipt$] ([MastInterferenceID], [Name], [Address], [Town], [County], [AmountPaid]) VALUES ('"+mastID+"','"+name+"','"+address+"','"+town+"','"+county+"','"+amount+"');") ;
     System.err.println(aPreparedStatement.executeUpdate());
     connectionObject.commit();
     System.err.println("Committed?");
      catch (Exception e)
        e.printStackTrace();
      finally
     try { aPreparedStatement.close();
           if(dmd!=null)
                        dmd = null;
           if(con!=null)
                        con.close();
            catch (Exception e) {}                    
    /   //==============instance variables=================================================//
   private Connection connectionObject;
   private Statement statementObject;
    * odbc name.
   private String ODBC = "jdbc:odbc:pl";
   //jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ=pathName;DriverID=22;READONLY=false","","");
   //Above used to write any xls file
   private String username = "";
   private String password = "";
}  

try { aPreparedStatement.close();
           if(dmd!=null)
                        dmd = null;
           if(con!=null)
                        con.close();
            catch (Exception e)
                 e.printStackTrace();  
            }instead of catching the last error i printed it and it came up with an error of nullPointerException
for the line of code
try { aPreparedStatement.close();how can i fix this error please
and thank you

Similar Messages

Maybe you are looking for

  • When did Lumia 630 receive denim update

    Lumia 639 updates

  • Cannot create a hybrid connection in website

    I want to add a hybrid connection to a brand new website but every time I try to create one, I get the same generic error: "Failed to create hybrid connection Failed to create hybrid connection <connection_name>. There was an error processing your re

  • Virus - can I scan to find out if I have one?

    I just created a network by using a router [Apple product] to connect a new PC to my iMac for the internet.  Because this PC has NO word processing of any sort [my husband thinks Microsoft should be sued], I wanted to download OpenOffice on it.  Unfo

  • Windows 7 Permissions Errors.

    Hey there, Since buying my Macbook Air recently I decided to put Windows 7 on it, only to find out that I keep getting massive problems regarding file and folder permissions. Most times when I go to install programs like Steam or other applications,

  • Hide and show button

    hi , i want when i click on show button then the show button hide and the hide button show , and vice versa , how i will do that through java script or any method plz help