Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Oracle JDBC error - SOLVED!

Re: Oracle JDBC error - SOLVED!

From: Galen Boyer <galen_boyer_at_yahoo.com>
Date: 29 Jul 2007 23:59:01 -0500
Message-ID: <ups2az4qt.fsf@rcn.com>


On Fri, 27 Jul 2007, hin_at_alma.com wrote:
> On Jul 26, 11:05 pm, Peter Ashford <peter.m.ashf..._at_gmail.com> wrote:

>> I got it!
>>
>>       PreparedStatement pStmt = db.prepareStatement(
>>                 "INSERT INTO departments ("+
>>                 "   deptName, schoolName, division, dean, AVC, HOD,
>> admin, adminPhone, adminEmail," +
>>                 "   streetAddress, city, cbCostCentre,
>> cbOHAccountCode, cbOHDisection, comments, " +
>>                 "   schoolLiasonAdmin, dateEntered)" +
>>                 "   VALUES (?,?,?,?,?,?,?,?,?,?"+
>>                 "           ?,?,?,?,?,?,?)");
>>
>> There's a missing comma between the lines of ?'s.

>
> Glad it works. If the makers of Oracle JDBC drivers
> are reading, I hope it is clear to them why
> JDBC should echo back the query text with the location of the
> parse error.

I'm not sure how jdbc is supposed to echo anything back to anywhere. An exception is an object. What Peter would have seen is a stack trace from the exception being hit.

Maybe the exception object needs to be amended so as to put more juicy stuff in the correct section of the exception object.

> If it did, Peter would have seen something like
>
> ------------------------------------------------
> Error, near <*> indicator in statement:
>
> INSERT INTO departments (
> deptName, schoolName, division, dean, AVC,
> HOD, admin, adminPhone, adminEmail, streetAddress, city,
> cbCostCentre, cbOHAccountCode, cbOHDisection, comments,
> schoolLiasonAdmin, dateEntered)
> VALUES (?,?,?,?,?,?,?,?,?,? <*> ?,?,?,?,?,?,?)
> ------------------------------------------------
>
> and we would not have known this 13-message thread.
>
> As I mentioned, the above is like what perl's, Lisp's and other Oracle
> "connectors" give you. Presumably most Oracle JDBC drivers
> are written on top of OCI,

The OCI driver would be, the thin driver would not. Which is what I'm guessing to really be the issue. I believe java wants the same exact behaviour from its OCI and thin layers. Since it cannot give the OCI behaviour in thin, I wonder if they forgo that behaviour and instead match the thin driver. Imagine if the exception handling mechanism coded by the client of the driver looked for a certain error and did something when it was hit. If the OCI driver returned a different error than the thin driver, then the substitution of different drivers might break the codebase.

> which enables the above error reporting via its API call,

>

> OCIAttrGet(..., OCI_ATTR_PARSE_ERROR_OFFSET, ...)
>
> JDBC driver developers everywhere: follow the clue.
> You can even adapt the OCI code in these other languages,
> which is open-sourced. We await your fix. ;)

You need to be barking at Oracle directly. It is their driver's not being verbose enough.

-- 
Galen Boyer
Received on Sun Jul 29 2007 - 23:59:01 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US