Book Image

Applying and Extending Oracle Spatial

By : Siva Ravada, Simon Greener
Book Image

Applying and Extending Oracle Spatial

By: Siva Ravada, Simon Greener

Overview of this book

Spatial applications should be developed in the same way that users develop other database applications: by starting with an integrated data model in which the SDO_GEOMETRY objects are just another attribute describing entities and by using as many of the database features as possible for managing the data. If a task can be done using a database feature like replication, then it should be done using the standard replication technology instead of inventing a new procedure for replicating spatial data. Sometimes solving a business problem using a PL/SQL function can be more powerful, accessible, and easier to use than trying to use external software. Because Oracle Spatial's offerings are standards compliant, this book shows you how Oracle Spatial technology can be used to build cross-vendor database solutions. Applying and Extending Oracle Spatial shows you the clever things that can be done not just with Oracle Spatial on its own, but in combination with other database technologies. This is a great resource book that will convince you to purchase other Oracle technology books on non-spatial specialist technologies because you will finally see that "spatial is not special: it is a small, fun, and clever part of a much larger whole".
Table of Contents (20 chapters)
Applying and Extending Oracle Spatial
About the Authors
About the Reviewers
Table Comparing Simple Feature Access/SQL and SQL/MM–Spatial

Creating Java Stored Procedures

We saw with JTSVersion.getJTSVersion and getJVMProperty how easy it is to write a new PL/SQL function that executes a Java method within the JVM. These Java classes and methods are called Java Stored Procedures. As we have seen, creating an interface between PL/SQL and Java is easy. But it is important to note that:

  • Java Stored Procedures are by default executed with invokers rights

  • PL/SQL procedures are by default executed with definer's rights

When writing functions using Java classes and methods, one must comply with the following rules:

  • No constructor method is needed

  • Variables and methods must be declared [b]static[/b]

  • Use the default database connection (no user ID/password required: uses session connection)

  • Declare output variables as arrays [where output is not singular]

  • Console output from System.out.println statements will be written to trace files in the Oracle UDUMP destination directory [get friendly with your DBA!]

Our first Java function – buffering...