<DIV> Hello Kevin:</DIV>
<DIV> </DIV>
<DIV> Thanks you send message to me, these days I solve one problem;</DIV>
<DIV> </DIV>
<DIV> In Postgis DOCUMENTATION,the source code is:</DIV>
<DIV> </DIV>
<DIV> <FONT color="#f00000">((org.postgresql.Connection)conn).addDataType("geometry","org.postgis.PGgeometry");</FONT></DIV>
<P><FONT color="#f00000"> <FONT color="#000000">the right code is:</FONT></FONT></P>
<P><FONT color="#f00000"><FONT color="#000000"> ((<FONT color="#00f000">org.psotgresql.jdbc3.Jdbc3Connection</FONT>)conn).addDataType ("geometry","org.postgis.PGgeometry");</FONT></FONT></P>
<P><FONT color="#f00000"><FONT color="#000000"> I seek the postgresql.jar and postgis-1.3.3.jar.</FONT></FONT></P>
<P><FONT color="#f00000"><FONT color="#000000"> But another problem is appeared.</FONT></FONT></P>
<P><FONT color="#f00000"><FONT color="#000000"> The code is:</FONT></FONT></P>
<P><FONT color="#f00000"><FONT color="#000000"> </FONT><FONT color="#f00000">PGgeometry geom = (PGgeometry)r.getObject(1);<BR><BR> System.out.println(geom.toString());</FONT></FONT></P>
<P><FONT color="#f00000"><FONT color="#f00000"> <FONT color="#000000">But I do not know how to solve the problem.</FONT></FONT></FONT></P>
<P><FONT color="#f00000"><FONT color="#f00000"><FONT color="#000000"> I use the computer language is jsp+Tomcat6.0 +JDK1.5.</FONT></FONT></FONT></P>
<P> Cheers,</P>
<P> john<FONT color="#f00000"><FONT color="#f00000"><BR></FONT></FONT></P>
<DIV><BR></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV></DIV><BR><PRE>在2008-10-21,"Kevin Neufeld" <kneufeld@refractions.net> 写道:
>Yeah, I was never fond of the postgis driver myself. Someday we'll have
>to revisit that.
>
>I use JTS rather than PGgeometry to read and write JTS Geometry objects
>... works very well.
>http://postgis.refractions.net/pipermail/postgis-users/2007-March/014911.html
>
>Cheers,
>Kevin
>
>John wrote:
>>
>>
>> My name is john, this day i have some problem about Postgis,
>>
>> I have readed Postgis Documentation, and try to compile source code.
>>
>> I am using Postgresql 8.2.10 version,and using the computer
>> language's java.
>>
>> I use the JDK 1.5 and Tomcat 6.0.
>>
>> In postgis-1.3.3.pdf source code is:
>>
>> 4.8 Java Clients (JDBC)
>>
>> import java.sql.*;
>> import java.util.*;
>> import java.lang.*;
>> import org.postgis.*;
>> public class JavaGIS {
>> public static void main(String[] args) {
>> java.sql.Connection conn;
>> try {
>> /*
>> * Load the JDBC driver and establish a connection.
>> */
>> ClassforName("org.postgresql.Driver");
>> String url = "jdbc:postgresql://localhost:5432/database";
>> conn = DriverManager.getConnection(url, "postgres", "");
>> /*
>> * 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.Connection)conn).addDataType("geometry","org.postgis.PGgeometry");
>>
>> ((org.postgresql.Connection)conn).addDataType("box3d","org.postgis.PGbox3d");
>> /*
>> * Create a statement and execute a select query.
>> */
>> Statement s = conn.createStatement();
>> ResultSet r = s.executeQuery("select AsText(geom) as geom,id from
>> geomtable");
>> while( r.next() ) {
>> /*
>> * Retrieve the geometry as an object then cast it to the geometry type.
>> * Print things out.
>> */
>> PGgeometry geom = (PGgeometry)r.getObject(1);
>> int id = r.getInt(2);
>> System.out.println("Row " + id + ":");
>> System.out.println(geom.toString());
>> }
>> s.close();
>> conn.close();
>> }
>> catch( Exception e ) {
>> e.printStackTrace();
>> }
>> }
>> }
>>
>> I can not compile this code successful, always report wrong .
>>
>> can you help me, send the right code to my email.
>>
>> Thanks
>>
>> john
>>
>>
>>
>>
>> ------------------------------------------------------------------------
>> [广告] 金秋最关注楼盘-房不胜房
>> <HTTP: link="" popme.163.com="">
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users@postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>_______________________________________________
>postgis-users mailing list
>postgis-users@postgis.refractions.net
>http://postgis.refractions.net/mailman/listinfo/postgis-users
</HTTP:></PRE><br><!-- footer --><br>
<hr>
<font style="font-size:12px;line-height:15px;">[广告] </font><font style="font-size:12px;line-height:15px;">金秋最</font><a style="font-size:12px;line-height:15px; color:blue; text-decoration:underline;" href="http://popme.163.com/link/003985_1010_7027.html">关注楼盘-房不胜房</a>