SAP db User Manual

Page of 158
SAP AG 
 
November 2002 
 
java TableDef jdbc:sapdb:TST?user=TEST&password=TEST DUMMY a 
varchar (20)
 
TABLE: DUMMY 
A: VARCHARASCII (20)
 
UNICODE in SQL Statements 
SQL statements can contain both UNICODE literals and UNICODE identifiers. The 
prerequisite for implementing these SQL statements is a UNICODE-enabled client (C/C++-
Precompiler, JDBC, ODBC, SQL Studio or Web SQL). 
The prerequisite for using UNICODE in the SQL Studio and Web SQL is that a UNICODE-
enabled ODBC has been installed. SQL Studio and Web SQL are used on the operating 
system Windows 2000. This operating system supports UNICODE. 
 
 Example 1 
The Java class TableDef can be used to display the results of various column definitions 
(see 
UNICODE and SQL [Page 
, section UNICODE for application data). 
TableDef Definition 
import java.sql.*; 
/** 
 * 
 */ 
public class TableDef 

    private Connection connection; 
    /** 
     * creates a new TableDef 
     */ 
   public 
    TableDef ( 
        String url) 
    throws SQLException, ClassNotFoundException 
    { 
        // load class 
        Class.forName ("com.sap.dbtech.jdbc.DriverSapDB"); 
        // create connection 
        this.connection = DriverManager.getConnection(url, 
            new java.util.Properties ()); 
        this.connection.setAutoCommit (false); 
    } 
    /** 
     * 
     */ 
    protected void 
    createTable ( 
        String tableName, 
        String createCommand) 
    throws SQLException 
    { 
        String fullCommand = "CREATE TABLE " + tableName + " (" 
            + createCommand + " )"; 
        Statement stmt = this.connection.createStatement (); 
        stmt.execute (fullCommand); 
    } 
    /** 
     * 
     */ 
    protected void 
User Manual: SAP DB 
 
94