Sunday, November 9, 2014

Data Source in Oracle GlassFish Server






Data Source in Oracle Weblogic

 Data sources offer a portable, vendor-independent method for creating connections to databases. A data source object's properties are set in a JNDI service provider so that it represents a particular database.
 An application can use JNDI Naming to do a lookup and use the data source for getting a connection.
·         Oracle XE database with HR schema
·         Oracle Weblogic Server 11g ( 10.3)
 Login into Weblogic console. The hostname and port number might be different than what is being used here.
b.       Username: Weblogic

c.        Password: welcome1


Expand “Services” and click on “Data Sources” in the left hand Domain Structure tree menu. List of currently configured displayed in the right pane. Click on “New” button to add a new data source and select “Generic Data Source”.
In the “Create a New JDBC Data Source”, enter the following information
a.       Name – used within Weblogic for display
b.       JNDI Name – a JNDI name to bind the Data Source in the JNDI services. Used to refer to the Data Source from Java or other applications. JDBC data sources typically have format: jdbc/DS.
c.        Database Type – Select database type from the list of databases like Oracle, MySQL, Derby, MS SQL Server etc.
Click Next
In the JDBC Data Source Properties, select the Database Driver



Click Next.

Click Next in the Transaction Options screen

Specify the Connection Properties
Click Next
In the Test Database Connection screen click on “Test Configuration” to test the settings.
Should get a message “Connection Test succeeded”.




Click Next
In the “Select Targets” screen, select the Weblogic servers in which the new data source has to be
deployed and click on “Finish”. The new data source should be visible in the data sources list.

To use the data source from a standalone java client (NOT for J2EE clients) some libraries are required. 
To generate required lib wljarbuilder.jar   :
          Navigate WLS\server\lib
          java –jar wljarbuilder.jar
          This will generate wlfullclient.jar
          Add this to classpath/app libraries
          (2) Modify this "setStartupEnv.cmd" file under the domain path so that remote app (like java prg) can use WL services.
          Path will be like this for integrated WLS (12c):-    C:\Users\\AppData\Roaming\JDeveloper\system12.1.2.0.40.66.68\DefaultDomain\bin\setStartupEnv.cmd
           In this file need to update 4 places this parameter to set true
 "-Dweblogic.jdbc.remoteEnabled=true".
          May also verify the below URL for weblogic 11g remote jdbc enabling.Enable Remote JDBC to connect to a Weblogic data Source -- TechnicalConfessions.com