Re: Getting query SQL from a JDBC PreparedStatement



joeNOSPAM@xxxxxxx wrote:

Nothing. There is no standard JDBC or sybase-specific
method or variable which exposes the SQL you gave the
connection when asking for a PreparedStatement. The
statement certainly does have a version of the string,
possibly modified for the JDBC SQL escapes, but you
would have to decompile, alter, and recompile, and run
your modified driver to be able to get it programmatically.

Thanks, Joe. That wasn't the answer I was expecting or hoping
for. Why wouldn't they provide that method? I assume it was
intentionally not provided, since it seems so obvious -- what
was the reason?

The workaround is straightforward -- build the string myself
instead of using the setXxxxx() methods, and send the completed
string to createStatement() or prepareStatement(). Not as
clean, but at least I have access to the completed SQL....
.



Relevant Pages

  • Re: [Help] How to make getText() return the result in case sensitive ?
    ... Use a PreparedStatement. ... You should basically never be constructing an SQL string in an app, unless you have a very good reason indeed. ... When I fill the UserIDTxt with "Test" and passwd with "myecg", or with other configuration like "TEST" and "MyECG", the result in the if statement produce "OK" sign. ...
    (comp.lang.java.programmer)
  • Re: Problems with Delete Command
    ... The SQL could get fairly messy if you need to construct it in code, ... ContactID, and WebComID, and create your on-the-fly SQL on that saved query, ... to find the list of ContactIDs from the junction table, ... This is a style/readability thing: if you are going to use string ...
    (microsoft.public.access.tablesdbdesign)
  • Re: JDBC PreparedStatements, Java Data Objects/O-R mapping, and SQL Injection
    ... "PreparedStatement objects represent SQL statements that can be prepared, ... the MySQL JDBC driver, since it's open source and widely used. ... protection against SQL injection gained by using PreparedStatements, ...
    (SecProg)
  • Re: Need help with Code Please!!!
    ... posted in response to my last post was some SQL, but this is not the SQL that ... the actual string that gets built at the end of the SQ1 build process. ... The message says Syntax error in query expression ... Dim rs As Recordset 'object ref to qryCompany\USFNumber ...
    (microsoft.public.access.formscoding)
  • RE: Web Part and Access database
    ... I dont know if it is possible to connect to access,but you can download SQL ... Server Error in '/Webparts' Application. ... The connection string specifies a local Sql Server Express instance ... String user, String password, Boolean trusted, String connectionString) ...
    (microsoft.public.sharepoint.portalserver.development)