Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
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-13-2007, 10:32 PM
Member
 
Join Date: Jul 2007
Posts: 44
susan is on a distinguished road
AWT-EventQueue-0 java.lang.NullPointerException
Hi, Can some one please help me, i have create a form in netbeans,my backend database choice is mysql, i am having problem inserting and dispalying data from the database.

this is the method i call when a submit button is clicked

Code:
public void InsertData() { Connection conn = null; //getData(); // PreparedStatement stmt = null; //String initials ; initials = jTextField1.getText(); name = jTextField2.getText(); surname = jTextField10.getText(); race = jTextField6.getText(); // email = jTextField6.getText(); company = jTextField3.getText(); //String type=(String)jList1.getSelectedItem(); //physical_add = jTextArea1.getText(); // postal_add = jTextArea2.getText(); System.out.println(initials); System.out.println(name); System.out.println(surname); System.out.println(race); System.out.println(company); String insertStr =""; String sql; // String sql2; String Statement; String select; //Statement stmt = conn.createStatement(); try{ sql= "insert into bus (initals, name, surname, comapany_name) values("+quotate(initials)+","+quotate(name)+","+quotate(surname)+","+quotate(company)+")"; int done=stmt.executeUpdate(sql); System.out.println("shows"); stmt.close(); conn.close(); //stmt.executeUpdate ( "INSERT INTO client( initials ) VALUES ( "+quotate(initials)+" ) " ); jTextField8.setText("1 row inserted"); getContentPane().removeAll(); initComponents(); } catch(Exception e){ jTextField8.setText("Error occurred in inserting data"); e.printStackTrace(System.err); } //String type =(String)jList1.getSelectedItem(); }
i get the fulling
  • java.lang.NullPointerException

then i have my second method

which dispalys data

Code:
private ResultSet getResultFromClient() { ResultSet rs=null; try{ rs=stmt.executeQuery("Select * from client"); System.out.println("name "+ rs.getString(1)); } catch(SQLException e){} return rs; }
i get the following
  • Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException

Thanks
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-16-2007, 06:41 AM
Member
 
Join Date: Jul 2007
Posts: 1
Lakhsika Rajakaruna is on a distinguished road
Hi Susan
What is the java, netbeans versions you are using?
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 07-16-2007, 07:21 AM
Member
 
Join Date: Jul 2007
Posts: 1
lakshika is on a distinguished road
I think the version of Netbeans does not matter as long as you are using the right platform. I'm getting the same error when compiling an earlier code that works well in java 1.5 but gives
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException

in jdk1.6 .
does any one have a solution for this?
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
java.lang.NullPointerException stevemcc AWT / Swing 2 02-08-2008 10:01 AM
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException hemanthjava AWT / Swing 3 01-29-2008 02:37 AM
java.lang.NullPointerException ravian New To Java 1 01-13-2008 08:39 PM
java.lang.NullPointerException Felissa Advanced Java 1 07-05-2007 07:02 AM
Error Java.lang.NullPointerException in JBuilder2006 Jack Other IDEs 2 07-02-2007 03:29 AM


All times are GMT +3. The time now is 05:28 AM.


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