The Java language in the backend JSP file if the Jgeometry object provided by Oracle spatial is manipulated

Source: Internet
Author: User

Write a journal, and record the problem that bothers you for a long, how to solve it at last. At that time felt the attempt to try, wondering how to solve the problem, and finally solved the ~

The correct code is as follows:

<%@ page contenttype= "text/html; charset=gb2312 "language=" java "import=" java.sql.*,java.lang.*,oracle.spatial.geometry.*,oracle.spatial.util.*, Oracle.sql.* "Errorpage=" "%><! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">Where, because the map is on port 8888, and the JSP file is under the WebApps folder under the Tomcat folder under the new project folder, on port 8080. To run in Chrome, you need the following code:

Response.AddHeader ("Access-control-allow-origin", "http://192.168.14.216:8888");

Then, because of the use of the Jgeometry object, the Jgeometry object is provided in Sdoapi.jar. Sdoapi.jar and Sdoutl.jar need to be used. Therefore, you need to import the corresponding package in the import of header information: oracle.spatial.geometry.*,oracle.spatial.util.*,oracle.sql.*

Import= "Java.sql.*,java.lang.*,oracle.spatial.geometry.*,oracle.spatial.util.*,oracle.sql.*"

I have previously imported oracle.spatial.geometry.*,oracle.jdbc.driver.*,oracle.sql.struct; Failure to import oracle.spatial.util.* may result in Jgeometry type error.

Before all are loaded in the browser JSP page times wrong jgeometry is undefined type. Later did not report this mistake, but still have the problem, always thought still this question, thought jgeometry not use. (Because before the jgeometry wrong time, there are times wrong sometimes do not report errors.) )

The program then removes the Sdo_geometry object from the Select Geom, then GetObject and load. Where the index in GetObject () refers to the total item index, not the index of the object. For example, the first property is a string, and the second property is Sdo_geometry. The values are GetString (1) and GetObject (2), respectively. I was a select *, then GetObject (1), so there is a problem. (The first of the select * is a string, the second is sdo_geometry)

SQLStatement = "Select Geom from the box where IDC =" +SP; ResultSet Res_room=stmt.executequery (SQLStatement), if (Res_room.next ()) {  struct dbobject= (struct) res_ Room.getobject (1);  Jgeometry geom=jgeometry.load (dbobject);


The Java language in the backend JSP file if the Jgeometry object provided by Oracle spatial is manipulated

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.