Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

sql problems

 
kelly devon
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Julian Kennedy
Ranch Hand
Posts: 823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thx all for the replies they really helped
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic