Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-09-2007, 05:30 PM
Member
 
Join Date: Jul 2007
Posts: 4
mooey1232003 is on a distinguished road
Help implementing JDBC
Hi i need help implementing JDBC in my program. The program stores info in a data file but i want it to save to a MS Access and also be able to read in the access file from the program.
Thanks.
Attached Files
File Type: zip Copy of InfoBook.zip (45.3 KB, 0 views)
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-09-2007, 06:03 PM
JavaBean's Avatar
Moderator
 
Join Date: May 2007
Posts: 1,272
JavaBean is on a distinguished road
Using JDBC is simple.

1. Convert your data file into database tables and store it seprately.
2. Access data on database using JDBC.

Here is a good tutorial for JDBC.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 07-11-2007, 12:04 AM
Member
 
Join Date: Jul 2007
Posts: 4
mooey1232003 is on a distinguished road
Thanks I will try that
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 07-11-2007, 06:51 PM
Member
 
Join Date: Jul 2007
Posts: 4
mooey1232003 is on a distinguished road
I tried to get the add button to connect to the DB but when i click the button i get errors.


"
java.lang.NullPointerException
at OperationHandler.ToDataBase(InfoBook.java:1027)
at InfoBook.actionPerformed(InfoBook.java:166)
at javax.swing.AbstractButton.fireActionPerformed(Unk nown Source)
at javax.swing.AbstractButton$ForwardActionEvents.act ionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed (Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseRe leased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent( Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(U nknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unkno wn Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
"

When i click the add new button it points to "public void toDatbase"
(line 1023)
The error is around there but i cant find it.
Source code.
Can anyone please help
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 07-11-2007, 06:57 PM
JavaBean's Avatar
Moderator
 
Join Date: May 2007
Posts: 1,272
JavaBean is on a distinguished road
Please write content of InfoBook.java here. (Place the code inside [code] tags.)
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 07-11-2007, 11:34 PM
Member
 
Join Date: Jul 2007
Posts: 4
mooey1232003 is on a distinguished road
I tried to put it inside tags but it said that i had to shorten it.I hope im not being to much trouble.

http://mooey.50webs.com/InfoBook.java

It is on the link that a provided

Thanks
Bookmark Post in Technorati
Reply With Quote
  #7 (permalink)  
Old 07-12-2007, 12:15 AM
JavaBean's Avatar
Moderator
 
Join Date: May 2007
Posts: 1,272
JavaBean is on a distinguished road
As far as i see, line 1027 is the line below:

Code:
String lblFirstName = txtFirstName.getText ();
The lines below are similar. I think your txtFirstName object is null there. You can check if it is null or not as follows:

Code:
if (txtFirstName == null) System.out.println("txtFirstName is null");
There should be some null objects there since NullPointerException occurs when you try to access properties or methods of a null object.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to use JDBC Template classes to control basic JDBC processing and error handling Java Tip Java Tips 0 04-01-2008 12:17 PM
implementing a button instead. birdofprey AWT / Swing 3 02-18-2008 05:21 AM
Implementing an interface bugger Advanced Java 1 01-09-2008 03:35 PM
How to use JDBC Template classes to control basic JDBC processing and error handling JavaBean Java Tips 0 09-28-2007 02:56 PM
Implementing Iterator Harb New To Java 6 08-05-2007 04:24 AM


All times are GMT +3. The time now is 10:27 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org