Init() PROGRAM
I have been trying to use a init() program to connect to a database (access) the problem is the program compiles and runs, but for some reason I can抰 access the database. when it runs I get an error java.lang.NullPointerException
(I do not have the code with me)
Main method call a class 揹atabase?with two variables to insert,
In 揹atabase?there is 搃nit()?method which is connecting to the database.
An 搃nsert?method to send the two variables to the database.
And a 揷lose?method which closes the database. (all very easy?)
There is nothing wrong with database connection or main method code.
Is it possible to use init() method without having to use servlets or applets, just on a win-dos screen.
If any one can help it would much appreciated.
[799 byte] By [
JJD108a] at [2007-10-2 19:58:17]

Where it tells you about a NullPointerException, it also tells you the stack trace associated with that exception. That stack trace can tell you where in your source code (which source file and line number) the exception occurred (or led to it). Go to that line and diagnose your code. You have a variable reference set to 'null' somewhere, and are trying to 'dereference' it directly or indirectly. Sprinkle some System.out.println statements in your code so that it can tell you what the values of variables are.
> Hi,
> Does that include connection to a database where you
> only have to connect to th e database ones, if yes
> can you point me in the right direction
> JJ
What?
The stacktrace will tell you everything you need to know. Post the stacktrace here, and we will be able to help you.
Kaj
kajbja at 2007-7-13 22:37:43 >

> Hi kaj,
> Thank for trying to help me I do not have the code
> with me, I will back later today with code and
> stacktrace
> Cheers
> JJ
I'm only glad if I can help. Post the stacktrace when you have it. I'm not sure that I will be reading the forum when you post but there are many others who also like to help, and they will probably answer when you post.
Kaj
kajbja at 2007-7-13 22:37:43 >
