<DIV> </DIV>
<DIV> </DIV>
<DIV> My name is john, this day i have some problem about Postgis,</DIV>
<DIV> </DIV>
<DIV> I have readed Postgis Documentation, and try to compile source code.</DIV>
<DIV> </DIV>
<DIV> I am using Postgresql 8.2.10 version,and using the computer language's java.</DIV>
<DIV> </DIV>
<DIV> I use the JDK 1.5 and Tomcat 6.0.</DIV>
<DIV> </DIV>
<DIV> In postgis-1.3.3.pdf source code is:</DIV>
<BLOCKQUOTE dir="ltr" style="MARGIN-RIGHT: 0px">
<DIV><FONT color="#f00000"><FONT color="#000000"> </FONT></FONT><FONT color="#f000f0"> 4.8 Java Clients (JDBC)</FONT></DIV><FONT color="#f00000">
<DIV><BR>import java.sql.*;<BR>import java.util.*;<BR>import java.lang.*;<BR>import org.postgis.*;<BR>public class JavaGIS {<BR>public static void main(String[] args) {<BR>java.sql.Connection conn;<BR> try {<BR>/*<BR>* Load the JDBC driver and establish a connection.<BR>*/<BR>ClassforName("org.postgresql.Driver");<BR>String url = "jdbc:postgresql://localhost:5432/database";<BR>conn = DriverManager.getConnection(url, "postgres", "");<BR>/*<BR>* Add the geometry types to the connection. Note that you<BR>* must cast the connection to the pgsql-specific connection<BR>* implementation before calling the addDataType() method.<BR>*/<BR>((org.postgresql.Connection)conn).addDataType("geometry","org.postgis.PGgeometry"); <BR>((org.postgresql.Connection)conn).addDataType("box3d","org.postgis.PGbox3d");<BR>/*<BR>* Create a statement and execute a select query.<BR>*/<BR>Statement s = conn.createStatement();<BR>ResultSet r = s.executeQuery("select AsText(geom) as geom,id from geomtable");<BR>while( r.next() ) {<BR>/*<BR>* Retrieve the geometry as an object then cast it to the geometry type.<BR>* Print things out.<BR>*/<BR>PGgeometry geom = (PGgeometry)r.getObject(1);<BR>int id = r.getInt(2);<BR>System.out.println("Row " + id + ":");<BR>System.out.println(geom.toString());<BR>}<BR>s.close();<BR>conn.close();<BR>}<BR>catch( Exception e ) {<BR>e.printStackTrace();<BR>}<BR>}<BR>}</DIV>
<DIV> </DIV>
<DIV></DIV></FONT><FONT color="#000000">I can not compile this code successful, always report wrong .</FONT>
<DIV><FONT color="#000000"></FONT> </DIV>
<DIV><FONT color="#000000">can you help me, s</FONT>end the right code to my email.</DIV>
<DIV> </DIV>
<DIV> Thanks</DIV>
<DIV> </DIV>
<DIV> john</DIV></BLOCKQUOTE>
<DIV> </DIV><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>