[fdo-users] Cannot insert to PostGIS

hanko hana.jaborova at spatialtechnology.se
Fri Jun 18 05:36:36 EDT 2010


I'm using the FDO PostgreSQL  ("OSGeo.PostgreSQL.3.5") provider to connect to
my PostGreSQL 8.2  + Postgis 1.4 database. 
I have an exception when i try to insert data with IInsert command.

My table in PostGIS (created with FDO):
CREATE TABLE "ShipSysSchema"."Ship"
(
  "ID" bigint NOT NULL DEFAULT
nextval('"ShipSysSchema"."Ship_ID_seq"'::regclass),
  "Test" character varying(255) NOT NULL,
  "Velocity" double precision NOT NULL,
  "Direction" double precision NOT NULL,
  "Geom" geometry,
  CONSTRAINT pk_shipsysschema_ship PRIMARY KEY ("ID"),
  CONSTRAINT "Ship_Direction_check" CHECK ("Direction" >= 0::double
precision AND "Direction" <= 360::double precision),
  CONSTRAINT "Ship_Velocity_check" CHECK ("Velocity" >= 0::double precision
AND "Velocity" < 100::double precision),
  CONSTRAINT "enforce_dims_Geom" CHECK (ndims("Geom") = 2),
  CONSTRAINT "enforce_srid_Geom" CHECK (srid("Geom") = 3007)
)
WITH (
  OIDS=FALSE
);

My code:
public void Insert()
{                   
	using (IInsert insertCommand =
(IInsert)FDOConnection.CreateCommand(OSGeo.FDO.Commands.CommandType.CommandType_Insert))
	{
		insertCommand.SetFeatureClassName("Ship"); // <- I get exception here
		IsertData(insertCommand, 10.5, 12.5, 11, 4);
		insertCommand.Execute();
	}
}

Exception: 
OSGeo.FDO.Common.Exception was caught
  Message="Creating/Updating a standalone instance for class ' Ship' is not
allowed "
  Source="OSGeo.FDO"

Do you have an idea why ? 

Thank, 

Hanko 
-- 
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Cannot-insert-to-PostGIS-tp5194654p5194654.html
Sent from the FDO Users mailing list archive at Nabble.com.


More information about the fdo-users mailing list