This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "sql  problems" Watch "sql  problems" New topic

sql problems

kelly devon
Ranch Hand

Joined: Apr 15, 2004
Posts: 75
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: 75
thx all for the replies they really helped
I agree. Here's the link:
subject: sql problems
Similar Threads
JDBC: MySQL vs. SQL Server?
WSAD 5.1.2 and MS SQL Server Express 2005
Architecture for online community
Does HF SQL cover creating efficient queries?
Book give away