Example: Establishing a Default Connection to Vantage
public class region { public static void getRegion(String[] data) throws SQLException { String sql = "SELECT Region FROM Sales WHERE ID = "; try { /* Establish default connection. */ Connection con = DriverManager.getConnection( "jdbc:default:connection " ); /* Execute the statement */ Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery( sql + data[0] ); rs.next(); data[0] = rs.getString("Region"); stmt.close(); } catch (Exception e) { throw new SQLException(e.getMessage(),"38U01"); } } ... }
Example: External Stored Procedure That Reads SQL Data
The following statement specifies the READS SQL DATA data access clause because the getRegion() method that implements the GetRegion external stored procedure (see dsq1593709706977.html#fuh1472240849902__exestabdefaultconn) executes a SELECT statement.
CREATE PROCEDURE GetRegion(INOUT Str VARCHAR(120)) LANGUAGE JAVA READS SQL DATA PARAMETER STYLE JAVA EXTERNAL NAME 'JarXSP:region.getRegion';