[postgis-users] jdbc PreparedStatement, setString

christomec christo at mecola.com
Tue Oct 4 01:51:27 PDT 2005

Hi all,

What am I doing wrong. I've tried different combinations, but I just cant
crack this one. the ? should look like this 'POINT(28.231594, -25.649567)'
to work. But I keep getting a "java.sql.SQLException: ERROR: parse error -
invalid geometry"

When this is figured out I'll need to set both the GeomFromText(?,-1).

            PreparedStatement suburbQuery = conn.prepareStatement(
                    "SELECT the_geom AS suburb " +
                    "FROM suburbs "+
                    "WHERE the_geom && Expand(GeomFromText(?,-1),.006) "+
                    "AND Distance(GeomFromText('POINT(28.231594,
-25.649567)',-1),the_geom) < .006;");

            suburbQuery.setString(1, "'POINT("+queryPoint.x+"

            ResultSet result = suburbQuery.executeQuery();

More information about the postgis-users mailing list