Reputation: 21
I have create a project with eclipse and added the postgis-jdbc-2.1.7.jar , postgresql-9.4.1208.jre6.jar to my class path.
Then I tried the example from the postgis documentation see example in order to connect to the db.
The following lines produce an error:
/*
* Add the geometry types to the connection. Note that you
* must cast the connection to the pgsql-specific connection
* implementation before calling the addDataType() method.
*/
((org.postgresql.PGConnection)conn).addDataType("geometry",Class.forName("org.postgis.PGgeometry"));
((org.postgresql.PGConnection)conn).addDataType("box3d",Class.forName("org.postgis.PGbox3d"));
The error is the following:
The method addDataType in the type connection is not applicable for the arguments
Has anyone else faced the same error?
Any ideas?
Upvotes: 0
Views: 72
Reputation: 11
Is this a run-time error? Perhaps Class.forName() is returning null. Try making a static reference to the class by replacing the call to "Class.forName()" with "org.postgis.PGgeometry.class" which will fail at compile time instead of run time if your classpath is off.
Upvotes: 1