wood burning stoves 2.0*
The moose likes JDBC and the fly likes JDBC code with type 1 driver not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "JDBC code with type 1 driver not working" Watch "JDBC code with type 1 driver not working" New topic
Author

JDBC code with type 1 driver not working

Pranit Sonawane
Ranch Hand

Joined: Jul 29, 2011
Posts: 155

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

Joined: Jan 10, 2002
Posts: 60765
    
  65

So what's the problem? You posted some code but haven't posted a question.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Pranit Sonawane
Ranch Hand

Joined: Jul 29, 2011
Posts: 155

Well am not getting the Record is Saved message. and record are not getting added to the database.!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60765
    
  65

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

Joined: Jul 29, 2011
Posts: 155

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

Joined: Jan 10, 2002
Posts: 60765
    
  65

You need to learn more about properly handling exceptions. At minimum you should log the exception.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JDBC code with type 1 driver not working
 
Similar Threads
How to position fieldset?
How to validate using annotation
request.parameter
Servlet-JDBC
Validation Issues