aspose file tools*
The moose likes JSP and the fly likes jsp and jdbc Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "jsp and jdbc" Watch "jsp and jdbc" New topic
Author

jsp and jdbc

arjita mahajan
Greenhorn

Joined: Nov 10, 2012
Posts: 11
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

Joined: Jan 08, 2009
Posts: 1477
    
    6

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.


Swastik
arjita mahajan
Greenhorn

Joined: Nov 10, 2012
Posts: 11
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

Joined: Jan 08, 2009
Posts: 1477
    
    6

Arjita,

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

arjita mahajan
Greenhorn

Joined: Nov 10, 2012
Posts: 11
thanks a lot , it was my stupidity i forgot the execute statement... thanks a lot.. :)
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1477
    
    6

You are most welcome.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: jsp and jdbc