Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.lang.NullPointerException jdbc sqlite

 
Dass Leyo Antoniraj
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello everyone,
i'm new to java ; i try to do a simple operation and i get null pointer exception. i try to connect sqlite with netbeans ; database is getting connected but createstatement raises this excpetion.
following is my code............

this is the error message.

java.lang.NullPointerException
at NewPackage.ConnectSQLite.main(ConnectSQLite.java:41)
 
K. Tsang
Bartender
Posts: 3583
16
Android Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In your posted code there are 2 "Connection". One on line 5 and another line 11. The problem line (14) is using the connection from line 5 (still null).

Why need to use 2 connections? Line 11 should have been
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic