NonStop Server for Java (NSJ) Programmer's Guide (NSJ 2.0+)

// Connect the program to the database, passing prop
conn = DriverManager.getConnection("jdbc:sqlmp:", prop);
// Create an SQL statement
stmt = conn.createStatement();
// Use the aliases instead of their Guardian filenames
rslt = stmt.executeQuery("select * from longname1 where col1='pickme'");
rslt = stmt.executeQuery("select * from longname2 where col1='pickme'");
Loading a Properties File Using a System Property
The JDBC driver (optionally) looks for a System property called jdbcPropfile. You can set this System property to
the name of a file containing alias properties and the JDBC driver will automatically load that file.
The following sample code uses that System property:
//Start your program specifying the System property jdbcPropfile
java -DjdbcPropfile=/h/mydir/jdbc-properties
-Djdbc.drivers=com.tandem.sqlmp.SQLMPDriver test1
//Create an SQL statement
stmt = conn.createStatement();
// Use the aliases instead of their Guardian filenames
rslt = stmt.executeQuery("select * from longname1 where col1='pickme'");
rslt = stmt.executeQuery("select * from longname2 where col1='pickme'");
Which SQL Statements Support Aliases
The following SQL statements support alias substitution:
In the Data Control Language (DCL):
CONTROL TABLE
LOCK TABLE
UNLOCK TABLE
In the Data Definition Language (DDL):
ALTER CATALOG
ALTER COLLATION
ALTER INDEX
ALTER PROGRAM
ALTER TABLE
ALTER VIEW
COMMENT
CREATE CATALOG
CREATE COLLATION
CREATE CONSTRAINT
CREATE INDEX
CREATE SYSTEM CATALOG
CREATE TABLE
CREATE VIEW