Sybase Technical Library - Product Manuals Home
[Search Forms] [Previous Section with Hits] [Next Section with Hits] [Clear Search] Expand Search

Chapter 5 XML Mappings [Table of Contents] Appendix B The sample_docs Example Table

XML Services in Adaptive Server Enterprise

[-] Appendix A Setting up XML Services

Appendix A

Setting up XML Services

This appendix provides instructions for setting up both the integrated XML processor and the Java-based processor.

Enabling the native XML processor

To use XML Services, you must enable it using this sp_configure command:

sp_configure "enable xml", 1

Installing the Java-based SQLX mapping functions

Since the functions in Chapter 4, "XML Mapping Functions" are Java-based, you must install them in the server before you can use them. This section provides instructions for installing the Java-based functions.

Java-based XML functions

These functions must be installed in the server before you can use them:

You can find guidelines and setup scripts for installing these facilities, together with source code and JavaDoc for them, in the following directory:

$SYBASE/$SYBASE_ASE/sample

Mapping function installation

To install the Java-based SQLX mapping functions, follow the procedures outlined in this section.

Environment variables

The environmental variables in Table A-1 already exist in the server utilities.

Table A-1: Environmental variables

Variable

Value

$ISERVER

"-S" parameter for isql and installjava utilities

$INTERFACES

"-I" parameter for isql and installjava utilities

$DB

"-D" parameter for isql and installjava utilities

Installing the parser

Install the Java-based XML parser, using either the make install-xerces command in the setup directory referenced in the directory $SYBASE/$SYBASE_ASE/sample, or a client utility command such as the following:

installjava -f $SYBASE/$SYBASE_ASE/lib/xerces.jar 
    -j "xerces_jar"\
    -D $DB  -S $ISERVER -I $INTERFACES
     -update  -Usa -P"" 

The Java-based XML parser is needed for forsqlcreatej, forsqlinsertj, and forsqlscriptj; it is not needed for forxmlj, forxmldtdj, forxmlschemaj, or forxmlallj.

Installing the mapping functions

Install the Java-based SQLX mapping classes, using either the make install-sqlx command in the setup directory referenced in $SYBASE/$SYBASE_ASE/sample, or a client utility command such as the following.

installjava
     -f.. /SQLX-examples/sqlx.jar -j"sqlx_jar"\
     -D $DB -S $ISERVER -I $INTERFACES
         -update -Usa -P"

Creating alias names

You can create SQL alias names for the Java methods of the SQLX mapping classes, using either the make sqlx-aliases command in the setup directory referenced in $SYBASE/$SYBASE_ASE/sample, or server SQL commands such as the following:

create procedure forxmlallj  
  (queryparmparm java.lang.String, optionparm
         java.lang.String,      
     out rsout java.lang.String,       
     out schemaout java.lang.String,       
     out dtdout java.lang.String )  
 language java parameter style java
external name "jcs.sqlx.ForXml.forXmlAll"  

create function forxmlj 
  (queryparm java.lang.String, optionparm
         java.lang.String)  
  returns java.lang.String  
  language java parameter style java   
  external name "jcs.sqlx.ForXml.forXml"  

create function forxmlschemaj  
  (queryparm java.lang.String,optionparm
         java.lang.String)  
  returns java.lang.String  
  language java parameter style java  
  external name "jcs.sqlx.ForXml.forXmlSchema"  

create function forxmldtdj 
  (queryparm java.lang.String, optionparm
        java.lang.String)  
  returns java.lang.String  
  language java parameter style java  
  external name "jcs.sqlx.ForXml.forXmlDTD"  

create function forsqlcreatej  
  (schemax java.lang.String, optionparm
        java.lang.String)  
  returns java.lang.String  
  language java parameter style java  
  external name "jcs.sqlx.SqlxCommand.forSqlCreate"   

create function forsqlinsertj 
  (inDoc java.lang.String, optionparm java.lang.String)
  returns java.lang.String  
  language java parameter style java 
  external name "jcs.sqlx.SqlxCommand.forSqlInsert"

create function forsqlscriptj 
 (schemax java.lang.String, inDoc java.lang.String,
  optionparm java.lang.String)  
  returns java.lang.String  
  language java parameter style java  
  external name "jcs.sqlx.SqlxCommand.forSqlScript" 


SQLX schema mapping [Table of Contents] Appendix B The sample_docs Example Table