File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes sql  problems Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "sql  problems" Watch "sql  problems" New topic
Author

sql problems

kelly devon
Ranch Hand

Joined: Apr 15, 2004
Posts: 75
hi,
i am having problems sending information to the database with sql
i tried ("INSERT INTO Borrow" + "name" + "date") but i got a nullpointer exception and cant seem to fix it. i'll really appreciate ur help
thx


kel
Julian Kennedy
Ranch Hand

Joined: Aug 02, 2004
Posts: 823
Hi Kelly,

I think you'd benefit from taking a little time to study Sun's JDBC Tutorial. There's a link to an SQL Primer in the introduction too, that you might find useful.

I say this because your trouble with the NullPointerException and your example SQL (it's quite a long way off ) suggest that you're very new to this type of programming, so taking a few hours to get a quality introduction to the subject will prove very worthwhile.

If you're in a real hurry for some reason then post a slightly a larger code snippet (your SQL string isn't the cause of your NullPointerException), e.g. where you connect, how you prepare the statement, etc. - make sure you use the UBB CODE tags so it'll be readable. However, I'm sure you understand that having the problem solved for you won't help you learn.

Jules
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

I don't guess we need more code.
The String:
"INSERT INTO Borrow" + "name" + "date"
expands to:
"INSERT INTO Borrownamedate"

A more fundamental Tutorial, (how to use Strings) might be appropriate.


http://home.arcor.de/hirnstrom/bewerbung
kelly devon
Ranch Hand

Joined: Apr 15, 2004
Posts: 75
thx all for the replies they really helped
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: sql problems