Discussion:
How do I get the JDBC SQL Statement that threw an error?
(too old to reply)
greenFrog
2004-12-14 11:07:07 UTC
Permalink
Hello,

I'm using an Oracle JDBC driver (OracleJDBC_r1-2.jar) to access an
Oracle 8.1.7 database. I'm developing an application using Struts
here, but I'm a complete newbie on this.

The problem I have is that my application often throws database
exceptions, e.g. "invalid column name". But I can't see the SQL
statement, because the Oracle JDBC driver doesn't display them.

A colleague of mine has written a "TracingJDBCDriver" around the
Oracle driver in order to display the SQL statements, but this Driver
doesn't work on my computer here - we've already spent hours on this
but we don't know why.

Well, I tried it from the database side, with the following statement:

select distinct s.program, a.* from v$session s, v$sqltext a
where s.sql_hash_value = a.hash_value
and s.sql_address = a.address
and s.schemaname='AENDMGMT'
order by a.address, a.hash_value, a.piece
/

I get SQL-statements displayed. But the statements that are wrong are
not in v$sqltext and they don't seem to be in any of the
v$sql...-views.

My question is: Does anybody know in which view I can find these
statements that were not correct?

Thank you very much
Uwe (greenFrog)
Sybrand Bakker
2004-12-14 18:49:32 UTC
Permalink
Post by greenFrog
My question is: Does anybody know in which view I can find these
statements that were not correct?
There isn't. If your statement doesn't parse in doesn't end up in the
shared pool, so it isn't listed in any view.
As posted yesterday, you can set up
alter session set event = '<errornumber> errorstack context forever,
level 3' to generate a trace file on the server.
Of course you could also debug your statements using sql*plus.

Please refrain from crossposting in the future.


--
Sybrand Bakker, Senior Oracle DBA

Loading...