import java.sql.*; public class CompositeType { public static void main(String args[]) throws Exception { Class.forName("org.postgresql.Driver"); Connection conn = DriverManager.getConnection("jdbc:postgresql://localhost:5830/jurka","jurka",""); Statement stmt = conn.createStatement(); try { stmt.execute("DROP TABLE comptable"); stmt.execute("DROP TYPE mycomplex"); } catch (SQLException sqle) {} stmt.execute("CREATE TYPE mycomplex AS (a int, b int) "); stmt.execute("CREATE TABLE comptable (id int, val mycomplex)"); stmt.execute("INSERT INTO comptable VALUES (1, ROW(2,3))"); ResultSet rs = stmt.executeQuery("SELECT id, val FROM comptable"); rs.next(); System.out.println(rs.getString(2)); } }