18 June 2009

Weblogic Server DataSource Using TNS Names

As of Oracle JDBC 10.2, it's possible to establish a connection with the thin driver using tnsnames.

http://download.oracle.com/docs/cd/B19306_01/java.102/b14355/urls.htm#BEIDIJCE

This allows you to store your database server details in an external tnsnames.ora file, which you then reference from the JDBC connection URL.

To use this with a Weblogic Server DataSource, try the following:

  1. Create a tnsnames.ora file with the required connection details and store it in a file that is accessible to the WLS instance:
    TEST =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = testserver)(PORT = 1521))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = test.au.oracle.com)
    )
    )

  2. Edit the setDomainEnv script for your domain and add the following System property
    -Doracle.net.tns_admin=<PATH_TO_TNS_NAMES_FILE>

  3. Create a DataSource and specify the connection URL to use the TNS names entry:
      <name>basic</name>
    <jdbc-driver-params>
    <url>jdbc:oracle:thin:@TEST</url>
    <driver-name>oracle.jdbc.xa.client.OracleXADataSource</driver-name>
    <properties>
    <property>
    <name>user</name>
    <value>banker</value>
    </property>
    </properties>
    <password-encrypted>{AES}fOJ/qlGxQjpdSiPODvxxilPHy/VuQe8yXggSSh1Lw4c=</password-encrypted>
    </jdbc-driver-params>

When the connection pool needs to create connections, it will lookup and use the specified TNS names entry from tnsnames.ora file in the directory specified oracle.net.tns_admin property.

12 June 2009

Displaying Server details in OEPE

When you have a Server defined in your OEPE environment, double-clicking on the icon presents the configuration page as shown below. For a single page, it's quite rich in detail, giving you access to the domain directories (assuming its local), the properties of the Server connection itself, how publishing is performed, and even a list of deployed modules in the domain.



Clicking on the "Open WebLogic Server Console" link opens the WLS Console directly within the Eclipse environment, where you can manage the server and all its resources as normal.

Note:
I found that when doing this with WLS 10.3.x caused any publishing events to fail since the WLS Console automatically acquires the edit lock in development mode, which prevents Eclipse from performing any application updates. Seems you'd need to to configure the use of Use Lock and Edit mode if you wanted to make use of this.

01 June 2009

WebLogic Schema Definitions

WebLogic Schema Definitions are available from this Oracle site:

http://www.oracle.com/technology/weblogic/index.html