Create Data Sources – SQL Server

SQL Server driver is not available by default while configuring a datasource on WebLogic.

Follow the below steps for details:

Registering Driver Class and Description

Add the following code snippet at the mentioned file.

This snippet contains a description of Driver Class and the proper use of it inside Oracle Weblogic Driver declaration.

$WL_HOME/server/lib/jdbcdrivers.xml (e.g. /scratch/oipa/Oracle/Middleware/Oracle_Home/wlserver/server/lib/jdbcdrivers.xml)

/scratch/oipa/Oracle/Middleware/Oracle_Home/wlserver/server/lib/jdbcdrivers.xml

<Driver
Database="MS SQL Server"
Vendor="Microsoft"
Type="Type 4"
DatabaseVersion="2005 and later"
ForXA="false"
ClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
URLHelperClassname="weblogic.jdbc.utils.MSSQL2005JDBC4DriverURLHelper"
TestSql="SELECT 1">
<Attribute Name="DbmsName" Required="true" InURL="true"/>
<Attribute Name="DbmsHost" Required="true" InURL="true"/>
<Attribute Name="DbmsPort" Required="true" InURL="true" DefaultValue="1433"/>
<Attribute Name="DbmsUsername" Required="true" InURL="false"/>
<Attribute Name="DbmsPassword" Required="true" InURL="false"/>
</Driver>

Note: Post these and restart WebLogic Admin.

Create the Data Source for ADMINSERVERDS

  1. Select Services> Data.
  2. In the configuration section on the right, click New and select Generic Data Source.
  3. In the JDBC Data Source Properties pane that appears:
    1. Change the Name. This name can be anything, but has to be unique for the entire WebLogic server. If there is more than one OIPA instance on the server, then each instance should have a unique name.
    2. Change the JNDI Name to ADMINSERVERDS. This name cannot be anything other than ADMINSERVERDS.
    3. Select the MS SQL Server database type.
  4. Click Next.
  5. Select the driver - MS SQL Server Driver (Type 4) Versions: 2005 and later Other
  6. Click Next.
  7. Click Next again when Transaction options are displayed.
  8. In the Connection Properties pane:
    1. Enter the Database Name.
    2. Enter the Host Name of the database server.
    3. Enter the Port number of the database server.
    4. Enter the Database user name. This can be obtained from the database administrator who installed the databases.
    5. Enter both password entries. This can be obtained from the database administrator who installed the databases.
    6. Click Next.
  9. On the following page, test the database connection using the URL as an example: jdbc:sqlserver://fsgbu-mum-420.snbomprshared1.gbucdsint02bom.oraclevcn.com:1600.
  1. Test the database connection.
  2. Click Next.
  3. In the Select Targets pane that appears, check the box for the OIPA application server. This links the data source to the server that was created.
  4. Select Finish.

Create the Data Source for ADMINSERVERRESOURCEDS

  1. Select Services> Data Sources.
  2. In the configuration section on the right, click New and then select Generic Data Source.
  3. In the JDBC Data Source Properties pane that appears:
    1. Change the Name. This name can be anything, but has to be unique for the entire WebLogic server. If there is more than one OIPA instance on the server, each instance should have a unique name.
    2. Change the JNDI Name to ADMINSERVERRESOURCEDS.
    3. Select the database type.
    4. Select the driver type.
  4. Click Next.
  5. Select Next again when Transaction options are displayed.
  6. In the Connection Properties pane:
    1. Enter the Database Name.
    2. Enter the Host Name of the database server.
    3. Enter the Port number of the database server.
    4. Enter the Database user name for a read-only user. This can be obtained from the database administrator who installed the databases.
    5. Enter both password entries. This can be obtained from the database administrator who installed the databases.
    6. Click Next.
  7. On the following page, test the database connection using the URL as an example: jdbc:sqlserver://fsgbu-mum-420.snbomprshared1.gbucdsint02bom.oraclevcn.com:1600.
  8. Test the database connection.
  9. Select Next.
  10. In the Select Targets pane that appears, check the box for the OIPA application server. This links the data source to the server that was created.
  11. Select Finish.

Create the Data Source for ADMINSERVERSEARCHDS

  1. Select Services> Data Sources.
  2. In the configuration section on the right, click New and then select Generic Data Source.
  3. In the JDBC Data Source Properties pane that appears:
    1. Change the Name. This name can be anything, but has to be unique for the entire WebLogic server. If you have more than one OIPA instance on the server, each instance should have a unique name.
    2. Change the JNDI Name to ADMINSERVERSEARCHDS.
    3. Select the database type.
    4. Select the driver type.
  4. Click Next.
  5. Click Next again when Transaction options are displayed.
  6. In the Connection Properties pane:
    1. Enter the Database Name.
    2. Enter the Host Name of the database server.
    3. Enter the Port number of the database server.
    4. Enter the Database user name for a read-only user. This can be obtained from the database administrator who installed the databases.
    5. Enter both password entries. This can be obtained from the database administrator who installed the databases.
    6. Click Next.
  7. On the following page, test the database connection using the URL as an example: sqlserver://fsgbu-mum-420.snbomprshared1.gbucdsint02bom.oraclevcn.com:1600.
  8. Test the database connection.
  9. Click Next.
  10. In the Select Targets pane that appears, check the box for the OIPA application server. This links the data source to the server that was created.
  11. Select Finish.

Create Data Source for ADMINSERVERREADONLYDS

  1. Select Services > Data Sources.
  2. In the configuration section on the right, click New and then select Generic Data Source.
  3. In the JDBC Data Source Properties pane that appears:
    1. Change the Name to ADMINSERVERREADONLYDS.
    2. Change the JNDI Name to ADMINSERVERREADONLYDS.
    3. Select the database type.
    4. Select the driver type.
  4. Click Next.
  5. Click Next again when Transaction options are displayed.
  6. In the Connection Properties pane:
    1. Enter the Database Name.
    2. Enter the Host Name of the database server.
    3. Enter the Port number of the database server.
    4. Enter the Database user name for the read-only user. This can be obtained from the database administrator who installed the databases.
    5. Enter both password entries. This can be obtained from the database administrator who installed the databases.
    6. Click Next.
  7. On the following page, test the database connection using the URL as an example: jdbc:sqlserver://fsgbu-mum-420.snbomprshared1.gbucdsint02bom.oraclevcn.com:1600.
  8. Test the database connection.
  9. Click Next.
  10. In the Select Targets pane that appears, check the box for the OIPA application server. This links the data source to the server that was created.
  11. Select Finish.

For SQL Server

When the encrypt property is set to true and the trustServerCertificate property is set to true, the Microsoft JDBC Driver for SQL Server won't validate the SQL Server TLS certificate. This setting is common for allowing connections in test environments, such as where the SQL Server instance has only a self-signed certificate.

jdbcUrl = jdbc:sqlserver://<host>:<port>;DatabaseName=<databasename>;encrypt=true;trustServerCertificate=true