1.1.1

Table Of Contents
getXXX() Method Called by
SQLFire for JDBC 3.0 and
4.0Column Type Declared by CREATE FUNCTION
getBigDecimal()NUMERIC
getFloat()REAL
getShort()SMALLINT
getTime()TIME
getTimestamp()TIMESTAMP
getString()VARCHAR
getBytes()VARCHAR FOR BIT DATA
Not supportedXML
Example Table Function
The following simple table function selects rows from a foreign database.
package com.acme.hrSchema;
import java.sql.*;
/**
* Sample Table Function for reading the employee table in an
* external database.
*/
public class EmployeeTable
{
public static ResultSet read()
throws SQLException
{
Connection conn = getConnection();
PreparedStatement ps = conn.prepareStatement( "select * from
hrSchema.EmployeeTable" );
return ps.executeQuery();
}
protected static Connection getConnection()
throws SQLException
{
String EXTERNAL_DRIVER = "com.mysql.jdbc.Driver";
try { Class.forName( EXTERNAL_DRIVER ); }
catch (ClassNotFoundException e) { throw new SQLException( "Could
not find class " + EXTERNAL_DRIVER ); }
Connection conn = DriverManager.getConnection
( "jdbc:mysql://localhost/hr?user=root&password=mysql-passwd"
);
return conn;
}
}
109
Using Table Functions to Import Data as a SQLFire Tables