File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes cast PreparedStatement to Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "cast PreparedStatement to" Watch "cast PreparedStatement to" New topic

cast PreparedStatement to

christine lorraine

Joined: Sep 03, 2001
Posts: 20
hi all,
i want to use the getLastInsertID() of mmMysql Driver because
according to the author it is thread safe.
in the documentation it was stated that i need to cast my
prepared statement to inorder
to use this specific function.
how can i do it? i tried several statements but i can't get it right. pls. help. or if you have other suggestions on how to
retrieve the last inserted id considering the thread safetiness issues.. i will appreciate it very much.

Joined: Jul 10, 2001
Posts: 3
If a simple cast does not work try creating a new object passing the PreparedStatement you already have, as an argument.
I agree. Here's the link:
subject: cast PreparedStatement to
It's not a secret anymore!