PDA

View Full Version : How do I get the JDBC SQL Statement that threw an error?


greenFrog
12-14-2004, 03:07 AM
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
12-14-2004, 10:49 AM
On 14 Dec 2004 03:07:07 -0800, uwe.embshoff@web.de (greenFrog) wrote:
My question is: Does anybody know in which view I can find thesestatements 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


MyLounge.com Site Map
Forum: Cars, Cell Phone, Database, Games, Home Improvement, IT, Music, School, Sports, Web Design, Web Server, Weight Loss

The MyLounge.com forum is intended for informational use only and should not be relied upon and is not a substitute for any advice. The information contained on MyLounge.com are opinions and suggestions of members and is not a representation of the opinions of MyLounge.com. MyLounge.com does not warrant or vouch for the accuracy, completeness or usefulness of any postings or the qualifications of any person responding. Please consult a expert or seek the services of an attorney in your area for more accuracy on your specific situation. Please note that our forums also serve as mirrors to Usenet newsgroups. Many posts you see on our forums are made by newsgroup users who may not be members of MyLounge.com Term of Service