I'm trying to insert an ipaddress into a Postgres Table from a Java project.
String ipIns = "INSERT INTO trusted_domains(id, from_ip, to_ip) VALUES (?, ?, ?);";
pstmt = conn.prepareStatement(ipIns);
pstmt.setInt(1, Integer.parseInt(id));
pstmt.setObject(2, InetAddress.getByName(fromIP));
pstmt.setObject(3, InetAddress.getByName(toIP));
pstmt.execute();
I get an exception for this statement pstmt.setObject(2, InetAddress.getByName(fromIP));
org.postgresql.util.PSQLException: ERROR: invalid input syntax for type inet:
Kindly help me on this exception
Thanks --SD