Use JdbcMeStatement in your Tier0 client application to run simple SQL statements that have no parameters and obtain ResultSets that the statements produce. The JdbcMeStatement class provides a subset of functions available in the IBM® Toolbox for Java™ AS400JDBCStatement class.
Use JdbcMeConnection.createStatement() to create new Statement objects.
The following example shows how to use a JdbcMeStatement object:
// Connect to the server.
JdbcMeConnection c = JdbcMeDriver.getConnection(
"jdbc:as400://mysystem.helloworld.com/mylibrary;naming=system;errors=full;meserver=myMeServer;" +
"user=auser;password=apassword");
// Create a Statement object.
JdbcMeStatement s = c.createStatement();
// Run an SQL statement that creates a table in the database.
s.executeUpdate("CREATE TABLE MYLIBRARY.MYTABLE (NAME VARCHAR(20), ID INTEGER)");
// Run an SQL statement that inserts a record into the table.
s.executeUpdate("INSERT INTO MYLIBRARY.MYTABLE (NAME, ID) VALUES ('DAVE', 123)");
// Run an SQL statement that inserts a record into the table.
s.executeUpdate("INSERT INTO MYLIBRARY.MYTABLE (NAME, ID) VALUES ('CINDY', 456)");
// Run an SQL query on the table.
JdbcMeLiveResultSet rs = s.executeQuery("SELECT * FROM MYLIBRARY.MYTABLE");
// Close the Statement and the Connection.
s.close();
c.close();