Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsp and jdbc

 
arjita mahajan
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am trying to connect jsp page to databse through javabean:


When I run the jsp file it is giving me error "username exists" even though no such data is getting entered (or present) in my login database (table login)
please help...
 
Swastik Dey
Rancher
Posts: 1603
5
Android Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are assigning User name exists value to variable error inside catch block, means it's raising some exception. Instead of assigning that message, you may wish to print the exception log trace, to figure out what exactly is going wrong. You could also try this error=e.toString(), this should print the actual exception on the page and might help you to figure out the real problem.
 
arjita mahajan
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok as suggested i founded that my sql query is not correct.. so i changed it to
String s = "insert into login values('upop','yss','ysss','asdy','aysdq',54,0);";
but even now my data is not getting entered into databse ... please help
 
Swastik Dey
Rancher
Posts: 1603
5
Android Java Java ME
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Arjita,

You are creating the sql string, but you don't seem to be executing any where.

 
arjita mahajan
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks a lot , it was my stupidity i forgot the execute statement... thanks a lot.. :)
 
Swastik Dey
Rancher
Posts: 1603
5
Android Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are most welcome.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic