wood burning stoves 2.0
The moose likes JDBC and Relational Databases and the fly likes sql  problems Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "sql  problems" Watch "sql  problems" New topic

sql problems

kelly devon
Ranch Hand

Joined: Apr 15, 2004
Posts: 77
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

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.

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.

kelly devon
Ranch Hand

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