Reconfiguring the SAS Content Server to Use a Database for Storage

Overview

The SAS Content Server supports using a database for storage. The default configuration for the SAS Content Server is to use the file system for storage, but SAS Deployment Wizard provides the Use configured database for content storage check box on the SAS Content Server: Repository Directory page. If that option is enabled, the wizard configures the SAS Content Server to use the same database that is used by the SAS Web Infrastructure Platform. The default configuration for the SAS Web Infrastructure Platform is to use the SAS Framework Data Server for database storage. However, the SAS Web Infrastructure Platform can be configured to use a third-party vendor database such as Oracle, MySQL, PostgreSQL, DB/2, or SQL Server.
When a third-party vendor database is used, make sure that the database is configured to accept large binary objects such as documents and images. For example, on MySQL, the max_allowed_packet variable must be set at least as large as the largest binary object in the SAS Content Server repository. If the SAS Deployment Wizard was not run with the Use configured database for content storage option, it is still possible to reconfigure SAS Content Server to use the same database that is used by the SAS Web Infrastructure Platform. The following sections describe how to reconfigure SAS Content Server.

JCRCopyRepository File

Obtaining the JCRCopyRepository File

To migrate the contents of the current SAS Content Server's repository to the database-based repository, obtain the JCRCopyRepository.bat or the JCRCopyRepository.sh file from SAS Technical Support. Place the script file in the SAS-config-dir\Lev1\Web\Utilities directory. This file should be customized for your environment. After the file is customized and saved, run the batch or script file to reconfigure the SAS Content Server and share the database used by SAS Web Infrastructure Platform Services.
Note: The JCRCopyRepository script file is not shipped with your software. To obtain a copy of the JCRCopyRepository script file, contact SAS Technical Support.
For information about running the JCRCopyRepository script file, see Reconfigure SAS Content Server.

JCRCopyRepository.bat File for Windows

Here is an example of the JCRCopyRepository.bat file in Windows:
@echo on
:Script for executing the JCRCopyRepository utility

setlocal

REM Define needed environment variables
call "%~dp0..\..\level_env.bat"

set LAUNCHERJAR=%SASVJR_HOME%\eclipse\plugins\sas.launcher.jar
set UTILITIESDIR=%LEVEL_ROOT%\Web\Utilities
set PICKLISTS=%SAS_HOME%\SASWebInfrastructurePlatform\9.3\Picklists\wars\
sas.svcs.scs\picklist
set DRIVER=path-to-jdbc-driver-JAR-file
set CLASSPATH=%UTILITIESDIR%;%LAUNCHERJAR%

"%JAVA_JRE_COMMAND%" ^
  -classpath "%CLASSPATH%" ^
  -Djava.system.class.loader=com.sas.app.AppClassLoader ^
  -Dsas.app.launch.config="%PICKLISTS%" ^
  -Dsas.app.repository.path="%SASVJR_REPOSITORYPATH%" ^
  -Dsas.app.class.path="%UTILITIESDIR%;%DRIVER%" ^
  -Djava.security.auth.login.config=%LEVEL_ROOT%\Web\Common\login.config^
  -Xmx256m ^
  -Dscs.jndi.jndiName=sas/jdbc/SharedServices ^
  -Dscs.jndi.jdbcUrl=jdbc-url ^
  -Dscs.jndi.driver=jdbc-driver-class^
  -Dscs.jndi.user=database-user ^
  -Dscs.jndi.pwd=password ^
  org.apache.jackrabbit.core.JCRCopyRepository %1 %2
endlocal
if [%2] EQU [exit] exit %ERRORLEVEL%

JCRCopyRepository.sh File for UNIX and z/OS

Here is an example of the JCRCopyRepository.sh file in UNIX:
#!/bin/sh
#
# JCRCopyRepository.sh
#
. `dirname $0`/../../level_env.sh
LAUNCHERJAR=$SASVJR_HOME/eclipse/plugins/sas.launcher.jar

UTILITIESDIR=$LEVEL_ROOT/Web/Utilities
PICKLISTS=$SAS_HOME/SASWebInfrastructurePlatform/9.3/Picklists
/wars/sas.svcs.scs/picklist
DRIVER=path-to-jdbc-driver-JAR-file
CLASSPATH=$UTILITIESDIR:$LAUNCHERJAR

"$JAVA_JRE_COMMAND" \
  -classpath "$CLASSPATH" \
  -Djava.system.class.loader=com.sas.app.AppClassLoader \
  -Dsas.app.launch.config="$PICKLISTS" \
  -Dsas.app.repository.path="$SASVJR_REPOSITORYPATH" \
  -Dsas.app.class.path="$UTILITIESDIR:$DRIVER" \
  -Djava.security.auth.login.config=../Common/login.config\
  -Xmx256m \
  -Dscs.jndi.jndiName=sas/jdbc/SharedServices \
  -Dscs.jndi.jdbcUrl=jdbc-url \
  -Dscs.jndi.driver=jdbc-driver-class \
  -Dscs.jndi.user=database-user \
  -Dscs.jndi.pwd=password \
 org.apache.jackrabbit.core.JCRCopyRepository $1  $2

exit 0

Reconfigure SAS Content Server

To reconfigure the SAS Content Server to use the same database that is used by SAS Web Infrastructure Platform, follow these steps.
  1. Stop the Web application server. Typically, this is SASServer1 in the Web application server's configuration directory.
  2. Rename the SAS Content Server repository from Repository to RepositoryFS.
    On Windows:
    move C:\SAS-config-dir\Lev1\AppData\SASContentServer\Repository C:\SAS-config-dir\Lev1\AppData\SASContentServer\RepositoryFS
    On UNIX and z/OS:
    mv SAS-config-dir/Lev1/AppData/SASContentServer/Repository SAS-config-dir/Lev1/AppData/SASContentServer/RepositoryFS
  3. In the previous step, you moved the Repository directory. Now, re-create the directory:
    On Windows:
    mkdir C:\SAS-config-dir\Lev1\AppData\SASContentServer\Repository
    On UNIX and z/OS:
    mkdir SAS-config-dir/Lev1/AppData/SASContentServer/Repository
    Note: If you are performing this procedure to configure SAS Web application clustering, then create a directory named SASServer2 and use it as the repository directory for the rest of this procedure.
  4. The contents of the repository.xml file should identify the database that is used for SAS Web Infrastructure Platform Services. Copy the repository.DatabaseName.xml file from the SAS-install-dir/SASWebInfrastructurePlatform/9.3/Static/wars/sas.svcs.scs/WEB-INF/templates directory to the directory that you created in the previous step. Then, rename this file as repository.xml.
    Copy Command Example for Windows
    copy C:\SAS_HOME\SASWebInfrastructurePlatform\9.3\Static\wars\sas.svcs.scs\
    WEB-INF\templates\repository.tkts.xml C:\SAS-config-dir\Lev1\AppData\
    SASContentServer\Repository\repository.xml
    Copy Command Example for UNIX
    cp /$SAS_HOME/SASWebInfrastructurePlatform/9.3/Static/wars/sas.svcs.scs/
    WEB-INF/templates/repository.tkts.xml SAS-config-dir/Lev1/AppData/
    SASContentServer/Repository/repository.xml
    Tip
    The SAS Framework Data Server uses the repository.tkts.xml file.
  5. Edit the repository.xml file and perform the following changes:
    1. Change all instances of @repository.jndi.url@ to sas/jdbc/SharedServices.
      For deployments that use JBoss, change the value to include the java: namespace prefix, java:sas/jdbc/SharedServices.
    2. Comment out the extidTypes attribute in the AccessManager element:
      <AccessManager class="org.apache.jackrabbit.core.CoreAccessManager">
      <!--
        <@extid.comment.start@param name="extidTypes" 
           value="@extid.types.list@"/@extid.comment.end@>
      -->
  6. Obtain the values for the database name, host, port, and user ID from the Web application server.
    • JBoss
      Open the SharedServices-ds.xml file located in the JBOSS_HOME/server/SASServer1/deploy/ directory. The user ID can be located in the JBOSS_HOME/server/SASServer1/conf/login-config.xml file, in the <application-policy name="webinfpltfm-encryptDBPassword"> section. You cannot use the password in the encrypted form that is used in the login-config.xml file. Use a SAS encoded version of the password.
      Tip
      Use the PWENCODE procedure to create an encoded password. For an example, see PWENCODE Procedure Example.
    • WebSphere Application Server
      In the WebSphere Admin Console, navigate to Resourcesthen selectJDBCthen selectData Sourcesthen selectCustom Properties
    • WebLogic Server
      In the WebLogic Admin Console, navigate to SASDomainthen selectServicesthen selectJDBCthen selectData Sourcesthen selectSharedServicesthen selectConfiguration and click on the Connection Pool tab.
  7. Contact your database administrator or system administrator if you do not know the password for the user ID.
  8. In the JCRCopyRepository script file that was placed in the SAS-config-dir/Web/Utilities directory, modify the value of the DRIVER parameter to indicate the path to the JDBC driver for the database:
    DRIVER=path-to-jdbc-driver-JAR-file
    The JAR file, or files, for the driver are located in SAS-config-dir\Levn\Web\Applications\SASWIPServices9.3\JDBCDrivers.
    If there is more than one JAR file in the directory, then specify a concatenated list of the JAR files in the directory. Separate the paths with either semi-colons (Windows) or colons (UNIX).
  9. Specify the values for user and password in the JCRCopyRepository script file. These values were retrieved earlier from your Web application server.
    -Dscs.jndi.user=database-user ^
    -Dscs.jndi.pwd=password ^
  10. In the same JCRCopyRepository script file, enter the values for the following parameters:
    -Dscs.jndi.jdbcUrl=jdbc-url ^
    -Dscs.jndi.driver=jdbc-driver-class ^
    The values specified for the JDBC URL and the driver are determined by the type of database used in your environment. The following table shows the examples of values for the different types of databases:
    Parameters and Values for JDBC URL and Driver
    Database
    Parameters
    Values
    SAS Framework Data Server
    -Dscs.jndi.jdbcUrl
    jdbc:sastkts://host:22031?constring=(DSN=SharedServices;encoding=UNICODE_FSS)
    -Dscs.jndi.driver
    com.sas.tkts.TKTSDriver
    Oracle
    -Dscs.jndi.jdbcUrl
    For Oracle:
    jdbc:oracle:thin:@host:1521:orcl
    For XE:
    jdbc:oracle:thin:@host:1521:xe
    -Dscs.jndi.driver
    oracle.jdbc.driver.OracleDriver
    PostgreSQL
    -Dscs.jndi.jdbcUrl
    jdbc:postgresql://host:5432/SharedServices
    -Dscs.jndi.driver
    org.postgresql.Driver
    DB2
    -Dscs.jndi.jdbcUrl
    jdbc:db2//host:50000/database
    -Dscs.jndi.driver
    com.ibm.db2.jcc.DB2Driver
    SQL Server
    -Dscs.jndi.jdbcUrl
    jdbc:sqlserver://host:1433;DataBaseName=SharedServices;SelectMethod=cursor
    -Dscs.jndi.driver
    com.microsoft.sqlserver.jdbc.SQLServerDriver
    MySQL
    -Dscs.jndi.jdbcUrl
    jdbc:mysql://host:3306/SharedServices
    -Dscs.jndi.driver
    com.mysql.jdbc.Driver
  11. In the command window, navigate to the SAS-config-dir/Lev1/Web/Utilities directory.
  12. Run the JCRCopyRepository script command by providing the complete directory path of the old and new repository directories.
    On Windows:
    JCRCopyRepository.bat C:\SAS-config-dir\Lev1\AppData\SASContentServer\RepositoryFS C:\SAS-config-dir\Lev1\AppData\SASContentServer\Repository
    On UNIX:
    ./JCRCopyRepository.sh SAS-config-dir/Lev1/AppData/SASContentServer/RepositoryFS SAS-config-dir/Lev1/AppData/SASContentServer/Repository
  13. To enable the changes to take effect, restart the Web application server. Typically, this is the SASServer1.