0
我有一個mysql數據庫表geometry
類型的列GEOMETRY
。 我以前用這個語句成功從表中僅查詢GEOMETRY
柱:從java中使用java獲取mysql中的類型幾何列的數據
String sql="SELECT AsText(GEOMETRY) from" +tableName+";";
現在,我想查詢這個表像這樣在它裏面的所有領域:
String sql="Select * from "+tableName+";";
Statement st=null;
ResultSet rs=null;
try {
st=(Statement) conn.createStatement();
rs=st.executeQuery(sql);
while(rs.next())
{
//...getting other fields
String wkt=rs.getString("AsText(GEOMETRY)");//error
//add all fields to an ArrayList
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
我在這裏得到這個錯誤:
Select * from ZMAPERP_equi_GIS_DB;
java.sql.SQLException: Column 'AsText(GEOMETRY)' not found.
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1084)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:987)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:973)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:918)
at com.mysql.jdbc.ResultSetImpl.findColumn(ResultSetImpl.java:1162)
at com.mysql.jdbc.ResultSetImpl.getString(ResultSetImpl.java:5728)
at com.hastha.marerp.googlemaps.DBUtils.getAllFeatures(DBUtils.java:340)
at com.hastha.marerp.googlemaps.LayerLoader.doGet(LayerLoader.java:48)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
我用了第二個,它worked.Thanks的答案,將接受只要我可以 – vamsiampolu 2014-09-01 16:13:56
@ user2309862謝謝:)祝你好運與你編程努力! – 2014-09-01 16:25:30