[postgis-users] problem using JDBC PreparedStatement

Just van den Broecke just at justobjects.nl
Mon Oct 9 15:43:55 PDT 2006


Hi,

I have a problem using prepared statements for insert/update with JDBC 
(org.postgis.DriverWrapperLW).

For example the PreparedStatement

INSERT INTO spatialone VALUES (?,?,?,?,?)
expands into
INSERT INTO spatialone VALUES 
(28,TheName,1160432443975,1160432443975,GeomFromText('POINT (4.92 
52.35)', 4326))

On execute this gives the error:
"org.postgresql.util.PSQLException: ERROR: column "point" is of type 
geometry but expression is of type character varying"

Prepared inserts/updates using class PGgeometryLW for this table work ok.

I've seen earlier posts on a similar issue, tried omitting/escaping the 
single quotes but to no avail. Below my version info. Thanks,

--Just


- version test
** PostGIS jdbc client code **
	getFullVersion: PostGIS JDBC V1.1.0

** PGJDBC Driver **
	getVersion: PostgreSQL 8.1 JDBC3 with SSL (build 407)
	getMajorVersion: 8
	getMinorVersion: 1

** PostgreSQL Server **
	version: PostgreSQL 8.1.3 on i686-apple-darwin8.7.1, compiled by GCC 
i686-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build 5363)

** PostGIS Server **
	postgis_version: 1.1 USE_GEOS=1 USE_PROJ=1 USE_STATS=1
	postgis_proj_version: Rel. 4.4.9, 29 Oct 2004
	postgis_scripts_installed: 1.1.1
	postgis_lib_version: 1.1.1
	postgis_scripts_released: 1.1.1
	postgis_uses_stats: t
	postgis_geos_version: 2.2.1-CAPI-1.0.1
	postgis_scripts_build_date: 2006-10-04 08:22:06
	postgis_lib_build_date: 2006-10-04 08:22:06
	postgis_full_version: POSTGIS="1.1.1" GEOS="2.2.1-CAPI-1.0.1" 
PROJ="Rel. 4.4.9, 29 Oct 2004" USE_STATS

-- 








More information about the postgis-users mailing list