Re: get SQL statement from PreparedStatement



JY wrote:
How can I get the SQL statement which will be submitted by the PreparedStatement to the database to execute?

Thanks



Can find a lot of examples at the "The Java Developers Almanac 1.4"
http://www.google.com/custom?domains=javaalmanac.com&q=PreparedStatement+&sa=Google+Search&sitesearch=javaalmanac.com&client=pub-6001183370374757&forid=1&ie=ISO-8859-1&oe=ISO-8859-1&cof=GALT%3A%23008000%3BGL%3A1%3BDIV%3A%23336699%3BVLC%3A663399%3BAH%3Acenter%3BBGC%3AFFFFFF%3BLBGC%3A336699%3BALC%3A0000FF%3BLC%3A0000FF%3BT%3A000000%3BGFNT%3A0000FF%3BGIMP%3A0000FF%3BFORID%3A1%3B&hl=en

Example: "e259. Inserting a Row into a Database Table Using a Prepared Statement"
http://javaalmanac.com/egs/java.sql/InsertPs.html

Documented in "The Big Index" here:http://java.sun.com/docs/books/tutorial/reallybigindex.html

under: "Trail: JDBC(TM) Database Access"


--

Thanks in Advance...
IchBin, Pocono Lake, Pa, USA http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
.



Relevant Pages

  • Re: get SQL statement from PreparedStatement
    ... PreparedStatement to the database to execute? ... SQL into some driver or database specific format that allows for value ...
    (comp.lang.java.programmer)
  • Re: get SQL statement from PreparedStatement
    ... PreparedStatement to the database to execute? ... SQL into some driver or database specific format that allows for value ...
    (comp.lang.java.programmer)
  • Re: get SQL statement from PreparedStatement
    ... The idea behind the prepared statement is that the driver or database will precompile the SQL into some driver or database specific format that allows for value bindings. ... If what you really wanted to achieve was to known what parameters are being passed to the PreparedStatement there are JDBC spy tools that can help. ... you do not "execute the SQL in PreparedStatement." ...
    (comp.lang.java.programmer)
  • Re: Unexpected Exception when inserting data in SQL 2000
    ... If a duplicate key insert is done the very first time I ... call .executeon the preparedstatement, ... I traced the call it is making to the database: ... which is supposed to prepare and execute the statement. ...
    (microsoft.public.sqlserver.jdbcdriver)
  • Re: year to date conversion
    ... the date in ISO-format, i.e. exactly in the format the OP requested. ... It is rare to need to be database independent. ... Sure, but again, there are moments, where a PreparedStatement ... The string is created by java.sql.Date, ...
    (comp.lang.java.programmer)