Tuesday, October 21, 2008

Oracle SDO2FreeEarth Step 1

Been experimenting with visualizations in FreeEarth from poly9 http://freeearth.poly9.com/. The nice thing about FreeEarth is that it is Flash based so that it doesn't require any web plugins.

Here I'll take a look at writing point data out from an Oracle SDO table and format in as a variable in javascript required by the FreeEarth website.

First let's connect to Oracle and query for our points.

// Load the driver
Class.forName("oracle.jdbc.driver.OracleDriver");

// Connection URL
String url = "jdbc:oracle:thin:@myserver:1521:mysid";

// Connect to the database
Connection conn = DriverManager.getConnection(url,"myuser", "mypwd");

conn.setAutoCommit(false);
Statement stmt = conn.createStatement();

// SQL with reference to SDO objects for point data
String sql = "select pt_id,p.shape.sdo_point.y,p.shape.sdo_point.x from mypoint_layer p";
ResultSet rset = stmt.executeQuery(sql);

No comments: