-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Martin Rösch wrote:
-----Ursprüngliche Nachricht-----
Von: Martin Rösch [mailto:[EMAIL PROTECTED]]
Gesendet: Donnerstag, 13. Februar 2003 13:20
An: [EMAIL PROTECTED]
Betreff: NullPointerException in the Java Connector


Hi,

attached is my report.

Thank you for your good work.

Kind regards
Martin Rösch

============================================================================
===

From: [EMAIL PROTECTED]
To:   [EMAIL PROTECTED]
Subject: Preparing a statement from a null Java String

Description:
	If  mySqlConnection.prepareStatement(aString) is called in Java
and aString is null, then I get a NullPointerException from deep within
MySQL (at least from my point of view). Here it is:

java.lang.NullPointerException
	at com.mysql.jdbc.PreparedStatement.<init>(Unknown Source)
	at com.mysql.jdbc.jdbc2.PreparedStatement.<init>(Unknown Source)
	at com.mysql.jdbc.jdbc2.Connection.prepareStatement(Unknown Source)
	at com.mysql.jdbc.jdbc2.Connection.prepareStatement(Unknown Source)
	at bos.Auftrag.initializeClass(Auftrag.java:120)
	at bos.Auftrag.getInsertPs(Auftrag.java:150)
	at bos.Auftrag.insertIntoDb(Auftrag.java:263)
	at bos.Auftrag.createTestObject(Auftrag.java:420)
	at bos.MyApplication.createTestData(MyApplication.java:110)
	at bos.MyApplication.<init>(MyApplication.java:57)

Here is the last line from *my* Java code (Auftrag.java:120):

selectAllPs = sqlConn.prepareStatement(selectAllPsString);

I fixed *my* side of the problem by correcting *my* error: I filled the
variable
selectAllPsString with the correct SQL-Command and the problem was gone.

What I would like to ask from you is to maybe provide a diagnostic message
or a java
exception that points straight to the problem like e.g. "Could not prepare
the statement.
Reason: the Java String was null. Fill the String with an SQL-Command and
try again".
This has already been addressed in the code that will be MySQL Connector/J 3.1.

Thank you for your comments!

-Mark

- -- MySQL 2003 Users Conference -> http://www.mysql.com/events/uc2003/

For technical support contracts, visit https://order.mysql.com/?ref=mmma

__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Mark Matthews <[EMAIL PROTECTED]>
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Full-Time Developer - JDBC/Java
/_/ /_/\_, /___/\___\_\___/ Flossmoor (Chicago), IL USA
<___/ www.mysql.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.1.90 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE+TAB/tvXNTca6JD8RAj1nAJ9hNF6IGHqtnFOvr0bVgkhnkIcBtgCbB1uE
33+RR42/iWgR9I5wGKFKtOE=
=UDXH
-----END PGP SIGNATURE-----


---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to