This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC 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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "java.sql.SQLException: Invalid column index?" Watch "java.sql.SQLException: Invalid column index?" New topic
Author

java.sql.SQLException: Invalid column index?

Tom Z. Smith
Greenhorn

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(DatabaseError.java:111)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:145)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:207)
at oracle.jdbc.driver.OraclePreparedStatement.setStringInternal(OraclePreparedStatement.java:5328)
at oracle.jdbc.driver.OraclePreparedStatement.setString(OraclePreparedStatement.java:5320)
at <mypackage>.UserCheck_2.Authenticate.authenticate(Authenticate.java:153)
at <mypackage>.UserCheck_2.UserCheckPortBindingImpl.checkUser(UserCheckPortBindingImpl.java:40)
at <mypackage>.UserCheckPortBindingSkeleton.checkUser(UserCheckPortBindingSkeleton.java:56)
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.providers.java.RPCProvider.invokeMethod(RPCProvider.java:397)
at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:186)
at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:454)
at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Unknown Source)


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

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: 50



Regards,

RK
 
wood burning stoves
 
subject: java.sql.SQLException: Invalid column index?
 
Similar Threads
Calling stored Procedure using hibernate
Hibernate Criterion query: org.hibernate.exception.SQLGrammarException: could not execute query
web application in eclipse 9
java.sql.SQLException: Invalid column index
Not authenticating the user