This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes java.sql.SQLException: Invalid column index? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "java.sql.SQLException: Invalid column index?" Watch "java.sql.SQLException: Invalid column index?" New topic

java.sql.SQLException: Invalid column index?

Tom Z. Smith

Joined: Aug 17, 2011
Posts: 6
Hi everyone... This is my first post, so let me know if you need anything else from me...

Basically, I'm having problems with my database object being able to do setString(). I'm not sure why. I think it's something to do with how I'm trying to use FOREACH logic with a hashmap to swap SQL queries? Who knows, but I do hope that someone around here can help me understand what's causing my woes.

Here's some of the code:

And here's the stack dump it's generating:
java.sql.SQLException: Invalid column index
at oracle.jdbc.driver.DatabaseError.throwSqlException(
at oracle.jdbc.driver.DatabaseError.throwSqlException(
at oracle.jdbc.driver.DatabaseError.throwSqlException(
at oracle.jdbc.driver.OraclePreparedStatement.setStringInternal(
at oracle.jdbc.driver.OraclePreparedStatement.setString(
at <mypackage>.UserCheck_2.Authenticate.authenticate(
at <mypackage>.UserCheck_2.UserCheckPortBindingImpl.checkUser(
at <mypackage>.UserCheckPortBindingSkeleton.checkUser(
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.axis.strategies.InvocationStrategy.visit(
at org.apache.axis.SimpleChain.doVisiting(
at org.apache.axis.SimpleChain.invoke(
at org.apache.axis.handlers.soap.SOAPService.invoke(
at org.apache.axis.server.AxisServer.invoke(
at org.apache.axis.transport.http.AxisServlet.doPost(
at javax.servlet.http.HttpServlet.service(
at org.apache.axis.transport.http.AxisServletBase.service(
at javax.servlet.http.HttpServlet.service(
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
at org.apache.catalina.core.ApplicationFilterChain.doFilter(
at org.apache.catalina.core.StandardWrapperValve.invoke(
at org.apache.catalina.core.StandardContextValve.invoke(
at org.apache.catalina.core.StandardHostValve.invoke(
at org.apache.catalina.valves.ErrorReportValve.invoke(
at org.apache.catalina.core.StandardEngineValve.invoke(
at org.apache.catalina.connector.CoyoteAdapter.service(
at org.apache.coyote.http11.Http11Processor.process(
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(
at Source)

What's causing this? As far as I know, the data types are correct...
Tom Z. Smith

Joined: Aug 17, 2011
Posts: 6
My apologies everyone, but I solved it...

I had been not only using single-quotes around the replacement token or substitution variable, but also included a semi-colon at the end of the query string! Ha. Hot damn!
(Java Ranch lingo, kiddies.)
rk sharma
Ranch Hand

Joined: Jun 25, 2011
Posts: 63


I agree. Here's the link:
subject: java.sql.SQLException: Invalid column index?
It's not a secret anymore!