• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDBC code with type 1 driver not working

 
Pranit Sonawane
Ranch Hand
Posts: 172
Java MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Following is my html page:


Following is the Servlet


I know am using type 1 driver but still please help me this program is just for my study purposes in which I need to use type 1 driver. Thanks...!!!
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65124
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So what's the problem? You posted some code but haven't posted a question.
 
Pranit Sonawane
Ranch Hand
Posts: 172
Java MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well am not getting the Record is Saved message. and record are not getting added to the database.!
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65124
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why is this code there?

}catch(Exception e){}

do you realize what that is doing?

You should never simply catch an exception and do nothing. All this is doing is hiding whatever exception you are getting that is preventing the code from running.

 
Pranit Sonawane
Ranch Hand
Posts: 172
Java MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
umm sorry i dint know this am new to java but would you like to tell how can i rewrite it now? many thanks!!!
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65124
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to learn more about properly handling exceptions. At minimum you should log the exception.
 
Rob Spoor
Sheriff
Pie
Posts: 20611
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear is right. You probably got an SQLException, but because you ignore it you don't know.
There are two easy fixes:
1) 2) Both will cause the exception to show up on the page (with the first one having a 500 HTML error code (internal server error)). Use this information to find the cause of the error.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic