aspose file tools*
The moose likes JDBC and the fly likes prepared statement in 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 » Databases » JDBC
Bookmark "prepared statement in jdbc" Watch "prepared statement in jdbc" New topic
Author

prepared statement in jdbc

raja maharaja
Greenhorn

Joined: Aug 15, 2009
Posts: 7
iam getting two errors in this code
one is at prepared sttement object
and the other at pst.executeUpdate()
these two errors are coming at lines 52 & 72 of the below code
here in this code whenever the result of ping is "request timed out " iam storing the date of that in the database and that iam doing with prepared statememt object.
but it is showing error at those two lines.

please tell me what mistake i have done???

Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39395
    
  28
And what are the errors? Are they compile-time or run-time errors? Look through the Connection interface and check the names of all methods very carefully.
raja maharaja
Greenhorn

Joined: Aug 15, 2009
Posts: 7
Campbell Ritchie wrote:And what are the errors? Are they compile-time or run-time errors? Look through the Connection interface and check the names of all methods very carefully.





two errrors are compiletime errors

and these are the errors


please tell me what mistake i have done , i wrote syntax correctly, please check
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39395
    
  28
You don't have a pst variable anywhere in scope at that time. And I have already given a hint about the other error.
raja maharaja
Greenhorn

Joined: Aug 15, 2009
Posts: 7
Campbell Ritchie wrote:You don't have a pst variable anywhere in scope at that time. And I have already given a hint about the other error.




ya i have resolved that error,but now one error left


please tell me what i should do to correct this error
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39395
    
  28
That is a new error, caused by your adding an unnecessary throws declaration (in the wrong place).
raja maharaja
Greenhorn

Joined: Aug 15, 2009
Posts: 7
Campbell Ritchie wrote:That is a new error, caused by your adding an unnecessary throws declaration (in the wrong place).



but if i remove that throws declaration from there ,iam getting some more errors.
please tell me what i can do to remove thsi error.
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30752
    
156

raja maharaja wrote:but if i remove that throws declaration from there ,iam getting some more errors.

Right. It's trying to tell you something. The typical form for JDBC code is:


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: prepared statement in jdbc