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 Datatype mapping with psotgres cidr type 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 Datatype mapping with psotgres cidr type" Watch "Java Datatype mapping with psotgres cidr type" New topic

Java Datatype mapping with psotgres cidr type

saakshi joshi

Joined: Aug 20, 2009
Posts: 3
I want to get the range of ipadresses stored postgres table with column type cidr .
But I am getting an exception when trying to insert any row through my javacode whenever I pass ipaddress value as String
ERROR: column "ipaddress" is of type cidr but expression is of type character varying

So does anyone know which JavaType is mapped with postgres cidr datatype?

Or is there any other way to find ipaddress range using Java and storing ipaddress as varchar in postgres table?

Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33132

Seems like it should be String. Can you show the code that throws the error.? Are you using the JDBC driver that came with the database?

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
I agree. Here's the link:
subject: Java Datatype mapping with psotgres cidr type
It's not a secret anymore!