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: John K. Hinsdale <hin_at_alma.com>
Date: Fri, 27 Jul 2007 06:13:35 -0700
Message-ID: <1185542015.957206.121370@z24g2000prh.googlegroups.com>


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. 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, 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. ;)

--JH Received on Fri Jul 27 2007 - 08:13:35 CDT

Original text of this message

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