Monday, April 4, 2016

Connect to MS SQL Database from Weblogic using Domain ID

MS SQL Database can be accessed using user domain id through Oracle Weblogic Server data source. This can be achieved using open source MS SQL driver JTDS. It can be downloaded from https://sourceforge.net/projects/jtds/files/jtds.

PRE-CONFIGURATION STEPS:-

  • Download the open source JDBC driver for Microsoft SQL Server.
  • Unzip the jtds-1.3.1-dist.zip 
  • Copy jtds-1.3.1.jar to $DOMAIN_HOME/lib
  • Restart the servers
CONFIGURATION STEPS:-

  • Click on "Lock & Edit" under "Change Center"
  • On the Home Page, Click on "Data Source" under "Services"
  • Under "Configuration" tab, Click on "New", select "Generic Data Source". Give the Name & JNDI Name.For Database Type. Select "MS SQL Server".Click "Next"
 
  • Select "Other" for "Database Driver"
    Click "Next"

  • Select the "Transaction Options"
    Click "Next"
  • Provide "Database User Name" & "Password"
    Click "Next"

  • Driver Class Name: net.sourceforge.jtds.jdbc.Driver
    URL: jdbc:jtds:sqlserver://mysqldb.mycompany.com:1433/DB_NAME;domain=MYCOMPANY;USENTLMV2=TRUE
    Click on "Test Configuration"
    Click "Next"

  • Select Targets
    Click "Finish"

Connection Factory in Weblogic adapter disappear



Issue: Connection Factory in Weblogic adapter disappear

Description: When I am trying to create a new connection factory, it disappears when the adapter is updated and changes are activated in the weblogic console.

Error Message: In Admin log below message is seen
JNDI lookup of 'eis/DB/SOAXACP' failed due to: While trying to lookup 'eis.DB/SOAXACP' didn't find subcontext 'eis'. Resolved ''
javax.naming.NameNotFoundException: While trying to lookup 'eis.DB/SOAXACP' didn't find subcontext 'eis'. Resolved ''; remaining name 'eis/DB/SOAXACP'
        at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1224)
        at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:268)
        at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.java:217)
        at weblogic.jndi.internal.BasicNamingNode.lookupIgnorePartition(BasicNamingNode.java:1503)

Cause: The issue is caused due to Plan.xml. It is either corrupted or belongs to different adapter (i.e. using jms adapter plan.xml to save db adapter connection factory)

Solution: Recreate a new Plan.xml and then try to add the new connection factory to it.