Top 5 Recent Articles
ARTICLES CATEGORIES
- Algorithms (22)
- All (399)
- Biography (1)
- Blog (44)
- Business Requirements (1)
- Commentary (1)
- Conversion (2)
- Customers (2)
- Data Models (1)
- Education (2)
- GeoRaptor (13)
- GPS (1)
- Image Processing (2)
- Import Export (8)
- Licensing (2)
- LiDAR (1)
- Linear Referencing (4)
- Manifold GIS (3)
- Mapping (1)
- MySQL Spatial (7)
- Networking and Routing (including Optimization) (5)
- Open Source (18)
- Oracle Spatial and Locator (194)
- Partitioning (1)
- PostGIS (36)
- Projections (1)
- Published Articles (1)
- qGIS (1)
- Recommendations (1)
- Services (1)
- Software Change Log (1)
- Source Code (37)
- Space Curves (9)
- Spatial Database Functions (109)
- Spatial DB comparison (1)
- Spatial XML Processing (11)
- SQL Server Spatial (92)
- Standards (3)
- Stored Procedure (17)
- Tessellation or Gridding (10)
- Tools (2)
- Topological Relationships (1)
- Training (2)
- Triangulation (2)
JTS Java class compilation for 11g and above
Java classes loaded into the Oracle JVM are interpreted when executed up to and including Oracle 10gR2. For Oracle 11g and upwards, these loaded Java classes can be compiled to native code.
I have added the optional compilation of my JTS Java wrappers and the source JTS classes to the JTS installer.
The installation is done using snippets of anonymous PL/SQL as follows.
1. Check correct version
WHENEVER SQLERROR EXIT FAILURE; SET serveroutput ON SIZE unlimited DECLARE l_version long; l_compatibility long; v_version varchar2(20); BEGIN dbms_utility.db_version(version => l_version, compatibility => l_compatibility); v_version := SUBSTR(l_version,1,2); IF ( NOT ( v_version > '10' ) ) THEN RAISE_APPLICATION_ERROR(-20000,'Can only compile java classes in Oracle 11g and later.'); END IF; END; / SHOW errors -- For 10g Error report: ORA-20000: Can ONLY compile java classes IN Oracle 11g AND later. ORA-06512: at line 9 20000. 00000 - "%s" *Cause: The stored PROCEDURE 'raise_application_error' was called which causes this error TO be generated. *Action: Correct the problem AS described IN the error message OR contact the application administrator OR DBA FOR more information.
2. Now compile
WHENEVER SQLERROR EXIT FAILURE; SET serveroutput ON SIZE unlimited DECLARE v_compile NUMBER; BEGIN FOR rec IN (SELECT name FROM user_java_classes) loop BEGIN v_compile := DBMS_JAVA.compile_class(rec.name); dbms_output.put_line('Compiling class ' || rec.name || ' resulted in ' || v_compile || ' methods being compiled.'); EXCEPTION WHEN OTHERS THEN dbms_output.put_line('Compile of Java class ' || rec.name || ' failed with ' || SQLCODE ); END; END loop; END; / SHOW ERRORS -- Results (11g) Compiling class com/spatialdbadvisor/dbutils/ora/GeoProcessing resulted IN 21 methods being compiled. Compiling class com/vividsolutions/jts/geom/GeometryFactory resulted IN 33 methods being compiled. Compiling class com/vividsolutions/jts/geom/PrecisionModel resulted IN 21 methods being compiled. Compiling class org/geotools/DATA/oracle/sdo/GeometryConverter resulted IN 23 methods being compiled. Compiling class com/vividsolutions/jts/geom/LineString resulted IN 31 methods being compiled. ....
The full JTS zip file has been uploaded to my website.
Documentation
- MySQL Spatial General Functions
- Oracle LRS Objects
- Oracle Spatial Exporter (Java + pl/SQL)
- Oracle Spatial Object Functions
- Oracle Spatial Object Functions (Multi Page)
- PostGIS pl/pgSQL Functions
- SC4O Oracle Java Topology Suite (Java + pl/SQL)
- SQL Server Spatial General TSQL Functions
- SQL Server Spatial LRS TSQL Functions