Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Regarding insertion in postgresql

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,
I am facing a problem. I would like to know how to insert a xml value in the database using java program.

The sample code is given below :-


The code works fine with mysql, but when i am executing the same with postgresql, it gives me a error, like

Exception: Bad value for type long : hi dears
org.postgresql.util.PSQLException: Bad value for type long : hi dears
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.toLong(AbstractJdbc2ResultSet.java:2736)
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.getLong(AbstractJdbc2ResultSet.java:2032)
at org.postgresql.jdbc3.Jdbc3ResultSet.getClob(Jdbc3ResultSet.java:43)
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.getClob(AbstractJdbc2ResultSet.java:386)
at MySqlClobSetClob.main(MySqlClobSetClob.java:36)



Awaiting the reply in this regards,


regards,

Sreejith Padmanabhan
 
Marshal
Posts: 69874
278
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Difficult to tell. Where is the exception actually thrown from that method? What is hi dears which I can't seem to find in the method. I looked up PostgreSQL for data types here and couldn't find long.

I think we ned more information, please.
 
Sreejith Padmanabhan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi dears is the value which comes from the xml file. the format of the xml file is like this

 
Campbell Ritchie
Marshal
Posts: 69874
278
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do you get "hi dears" into a long?
 
    Bookmark Topic Watch Topic
  • New Topic