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
-
please i really need help!
I had the same problem on my Mac Pro, iPad, Macbook Pro. Could not load iTunes, App Store or any support community. Called Apple Care and she asked if I had rebooted my router in awhile. I had not. Each of these would load half way and then just stop. She said iTunes and App Store could be stopped as they are different than my Discover or e-Bay accounts, which were fine. So during the 75 min call I pulled the power cord of the Netgear Wi Fi router, let it sit for 2 or 3 min and then replugged the power adapter. In about 4 to 5 min the sites started to load, although not displayed correctly. After quitting and re-starting the apps in question they are working fine again. But this has happened twice now in a 6 hour time period. So give it a try, but also give it a couple of tries.
-
My ios update keeps getting stuck on the Restoring iPhone software stage. I uninstalled iTunes and reinstalled it again, but still nothing. Now I can't even use my phone as it shows the plug into iTunes screen. Please help!!!! Thanks,
A Restore first downloads a new copy of iOS to your computer. On a slow Internet connection this can take a long time. How fast is your connection? How long would you expect it to take to download 900 MB?
That's assuming nothing is interfering with the download. Some firewalls and antivirus programs will block the download or slow it down. So you should temporarily disable your security software. Security software can also block the update after the iOS download is complete. -
Mail suddenly stopped getting my IMAP emails from my provider yesterday. I checked the passwords and all ok. Then deleted the account and re-entered it but still nothing. Strangely everything is fine on my iPhone 4! Maybe I need to delete and download a new Mail app? Any suggestions welcome!
For future mail problems.
iOS: Unable to send or receive email
http://support.apple.com/kb/TS3899
Can’t Send Emails on iPad – Troubleshooting Steps
http://ipadhelp.com/ipad-help/ipad-cant-send-emails-troubleshooting-steps/
Setting up and troubleshooting Mail
http://www.apple.com/support/ipad/assistant/mail/
iPad Mail
http://www.apple.com/support/ipad/mail/
Try this first - Reset the iPad by holding down on the Sleep and Home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons. (This is equivalent to rebooting your computer.)
Or this - Delete the account in Mail and then set it up again. Settings->Mail, Contacts, Calendars -> Accounts Tap on the Account, then on the red button that says Remove Account.
Cheers, Tom -
when i sync it comes on, however it doesnt completly sync it just says wait till applies are being changed or something like that and it can go on all night, but still nothing.
Read here for information about your issue. http://support.apple.com/kb/TS1538
-
iPod touch not responding and has white screen. Tried to restore, drain battery and re-charge etc but still nothing. What can I do?
Try what you have not tried so far. You may have tried all and the Apple store maybe in order.
- iOS: Not responding or does not turn on
- Also try DFU mode after try recovery mode
How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
- If not successful and you can't fully turn the iPod fully off, let the battery fully drain. After charging for an least an hour try the above again.
- If still not successful that indicates a hardware problem and an appointment at the Genius Bar of an Apple store is in order.
Apple Retail Store - Genius Bar -
When making a call, sometimes, my iPhone 5 , gets stuck on 'Calling' than I have to press END..but still nothing happens, than when I press HOME button, the call app keeps running in the background and it keeps saying CALLING... than I have to wait 2 - 3 minutes and call again.
please helpHas nothing to do with the SIM or master reset. This has been done to my phone. The SIM once and the factory reset many times over. You all just sold us a bad piece of equipment and have us by the tail with our contracts so none of us can get a new phone without paying full price or re-upping our contract. I just got off the phone last night with your high up tech people (you know, the hidden number we get once we tear into your support people enough), they went into my phone again and still didn't find anything wrong. I about got fired from my job for not getting my calls and texts. The BBB has now been contacted, and I feel your end should shore this up for all of us!
-
my ipod has a frozen white screen i have gone through all the holding buttons procedures and reset on laptop but still nothing,could it be the touch screen which was replaced around a month ago but has worked fine till now
Couold be related tot he sscreen replacment
Try:
- iOS: Not responding or does not turn on
- Also try DFU mode after try recovery mode
How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
- If not successful and you can't fully turn the iOS device fully off, let the battery fully drain. After charging for an least an hour try the above again.
- Try on another computer
- If still not successful that usually indicates a hardware problem. I would take it back to where the screen was replaced. -
My 16gb iPhone 4S keep tell me that my storage is almost full and I don't have enough space for any upgrades. I don't have any music or videos on my phone. I deleted all old emails, texts, contacts and apps but still nothing. When I check my settings, I noticed that my Instagram is at 732mb and it keeps rising. Now it's at 814mb. Please help!!!!!
What is the precise wording of the message that is occurring?
Are you attempting to update via iTunes on a computer or over the air on the device?
How much free space is actually on the device?
If updating via iTunes on the computer, how much free space on the computer? -
A few days after i've updated to iOS 8.1.1 my iphone 5s died and isn't turning on and its not charging. i have my legit charger that came with my phone and after 6 months it stopped working, i even have a charging case and that wont charge it. I google searched the problem and tried cleaning the charging port but still nothing! some please help
Please make a Genius Appointment and take it in for service.
If your iPod Touch, iPhone, or iPad is Broken
Apple does not fix iDevices. Instead, they exchange yours for a refurbished or new replacement depending upon the age of your device and refurbished inventories. On rare occasions when there are no longer refurbished units for your older model, they may replace it with the next newer model.
ATTN: Beginning July 2013 Apple Stores are now equipped to do screen repairs/replacements in-house on iPhone 5 and 5C. In some cases while you wait. According to Apple this is the beginning of equipping Apple Stores with the resources needed to do most repairs for iPhones, iPads, and iPod Touches that would not require major replacements. Later in the year the services may be extended as Apple Stores become equipped and staffed with the proper repair expertise. So, if you need a screen repaired or a broken screen replaced or have your stuck Home button fixed, call your local Apple Store to see if they are now doing these in-house.
You may take your device to an Apple retailer for help or you may call Customer Service and arrange to send your device to Apple:
Apple Store Customer Service at 1-800-676-2775 or visit online Help for more information.
To contact product and tech support: Contacting Apple for support and service - this includes international calling numbers.
You will find respective repair costs in the appropriate link:
iPod Service Support and Costs
iPhone Service Support and Costs
iPad Service Support and Costs
There are third-party firms that do repairs on iDevices, and there are places where you can order parts to DIY if you feel up to the task:
1. iResq or Google for others.
2. Buy and replace screen yourself: iFixit -
ok, so heres my problem . I have this ipod touch 4g and i was updating it to the newst version and the screen turned white i tried connecting it to the computer and nothing i pressed the home and main button but still nothing i dont want to pull it apart or anything but please help what do i do
Let the battery fully drain. After charging for an hour try the reset (both buttons) and restore as necessary.
-
Im having major problems syncing my iphone 4 to itunes, this problem started after upgrading to ios 5. I have upgraded my itunes, turned sync by wifi on and off but still nothing. Everytime I try to sync my iphone it just says sync cancelled. Please help.....
I'm having the same problem ! Each time the sync starts it suddenly stops and says finished syncing
-
Why can't I save text I've entered into a PDF file? When I hit "Save As", only the PDF document is saved, but not the text i typed into the document. I'm using Windows 8.
THANK YOU!
Jan Whitfield
The College Planning Center
250 Palladio Parkway, Suite 1311
Folsom, CA 95630
(916) 985-0453
www.TheCollegePlanningCenter.com -
I cannot unlock my phone. When I hit the number the key is highlighted but the "dot" does not show in the passcode box. Have shut it off and restarted nothing. Held on/off and "square" key to reset but still nothing. Any ideas on how to resolve this issue
Connect to iTunes and try to reset it from there.
-
having trouble with iphone not turning on orsomething wrong with screen have tried restoring and restting it but still nothing??
This sounds like you have tried the steps I would recommend. You said, "tried restoring and restting it but still nothing??"
1. When you are done Restoring Firmware, does iTunes show your iPhone's information. If yes then your iPhone is ON and working. Next step is to Reset, like you tried, but do it again, hold both Home and Power buttons until the iPhone restarts, usually less than 15 seconds. If still no screen, hold iPhone in bright light and look at screen, is an image there? If yes, you have a "No Backlight Problem".
2. If still no image, but you have confirmed iPhone is on with iTunes or switching Vibrate Switch and getting vibration. Then take iPhone to Apple and ask Genius to reconnect the Flex Cable #1 LCD Display Flex to the Logic Board. Before opening and during all repairs it is best if the iPhone 3GS is OFF.
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,
-
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