wood burning stoves 2.0*
The moose likes JDBC 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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
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
internet detective

Joined: May 26, 2003
Posts: 30130

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?

[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
I agree. Here's the link: http://aspose.com/file-tools
subject: Java Datatype mapping with psotgres cidr type
Similar Threads
CIDR to IP range
JPA Annotation @Column + column defination
'java.sql.SQLException: Out of range value for column' error
Hibernate Mapping Types.
How to pass BLOB to a PL/SQL Stored Procedure