• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Weird "Invalid column type" error

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey guys
I was wandering if you could help me with this one.
I use jdk 1.4 and Oracle 9i and currently building a simple application
Which saves data to a DataBase. All was going well until one day I
Suddenly got this exception while trying to save information which was
Working fine just the other day:
SQLException : java.sql.SQLException: Invalid column type
I have searched my code and DB for days trying to find my mistake, and
Couldn't find it, even my most experienced colleagues tried and failed.
The types and nulls allowed are all correct.
Since then this problem popped up in another few places which the save
Was working fine just a few days ago. I have searched and googled high
And low and couldn't find an answer, could anyone help me?
 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey,
Is there any chance you could post some of the offending code and possibly details of the db. As the error says it suggest that it is receiving something unexpected/illegal in the data being passed to the db.

I've always found displaying the created sql command useful, sometimes helps debugging the sql statements.
 
Noam Y. Tenne
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, sorry for the lack of info, i was just in a hurry

here ais the code were i insert the data:
UPDATE pdrecord#Army SET needsMedicalInquiry = ?, needsCommity = ?,
assignedProfessionComment = ? WHERE personId=636

as you can see I insert to the prepared statement the variables needsMedicalInquiry a boolean value and then this exception pops up:

java.sql.SQLException: Invalid column type
at oracle.jdbc.dbaccess.DBError,throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError,throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError,throwSqlException(DBError.java:269)
at oracle.jdbc.driver.oraclePerparedStatement.setObject(OraclePerparedStatement.java:3088)
at oracle.jdbc.driver.oraclePerparedStatement.setObject(OraclePerparedStatement.java:3107)
at erp.services.pdrecord.server.PDRecordCollection.doUDATEQuery(PDRecordCollection.java:285)

of course there are more lines of the error message but it is not relevant
 
Jamie Wool
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I had a similar problem with copying data using the prepare statement, which turned out to be the way that the prepare statement adds single quotation marks to code. Also note the it uses '1' instead of true. See my code example below.

I haven't got Oracle installed at the moment so couldn't test exactly what oracle expects, so you will need to have a play. I would personally create a working statement manually in oracle, then experiment until the prepare staement to generate the exact same code.


The code




I hope this helps a bit?
 
Noam Y. Tenne
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'll try it out, thanks
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic