Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / July 2007

Tip: Looking for answers? Try searching our database.

Oracle JDBC error

Thread view: 
Peter Ashford - 26 Jul 2007 04:34 GMT
I'm getting this error doing an SQL insert:

java.sql.SQLException: ORA-01745: invalid host/bind variable name

I know there's no invalid names in the insert because I can insert
data into the table by hand over sqlplus.

I'm using oracle's ojbdc14 jdbc driver and Java 1.6.

Any ideas?
garlington@tiscali.co.uk - 26 Jul 2007 13:21 GMT
> I'm getting this error doing an SQL insert:
>
[quoted text clipped - 6 lines]
>
> Any ideas?

What does your insert statement look like? The actual code will help.
Peter Ashford - 27 Jul 2007 00:45 GMT
On Jul 27, 12:21 am, garling...@tiscali.co.uk wrote:

> > I'm getting this error doing an SQL insert:
>
[quoted text clipped - 8 lines]
>
> What does your insert statement look like? The actual code will help.

This is how I make the statement in Java:

 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 (?,?,?,?,?,?,?,?,?,?"+
               "           ?,?,?,?,?,?,?)");

Doing the same insert in sqlplus using 'test' for all the varchars and
a dummy numbers and dates for all the other fields works fine.

I'm wondering if it's something to do with the JDBC driver, thou I've
checked and I definitely have the right versus for my version of
Oracle.
Lee Fesperman - 28 Jul 2007 21:38 GMT
> On Jul 27, 12:21 am, garling...@tiscali.co.uk wrote:
> >
[quoted text clipped - 11 lines]
>                 "   VALUES (?,?,?,?,?,?,?,?,?,?"+
>                 "           ?,?,?,?,?,?,?)");

You're missing a comma (,) between the 10th and 11th question mark (?)
in the VALUES list.

--
Lee Fesperman, FFE Software, Inc. (http://www.firstsql.com)
==============================================================
* The Ultimate DBMS is here!
* FirstSQL/J Object/Relational DBMS  (http://www.firstsql.com)


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.