Pages

Wednesday, 20 August 2014

Configuring datasources for RAC DB in SOA 10G



Configuring datasources for RAC DB
Fast Connection Failover provides failover for a JDBC
connection to a 10g R1 or 10g R2 RAC database. Upon
failure of a RAC node, Oracle Notification Service (ONS) detects the failure
and an SQL exception is thrown to application code. To enable Fast Connection
Failover on APPHOST1 and APPHOST2:
1.  Open the ORACLE_HOME/opmn/conf/opmn.xml file.
2.   Add the RAC database hostname and remote port
identifiers:
<notification-server>
<port local="6100" remote="6200" request="6003"/>
<ssl enabled="false" wallet-file="$ORACLE_HOME\opmn\conf\ssl.wlt\default"/>
<topology>                                                                                                   <nodeslist="apphost1:5121,apphost2:5121,webhost1:5121,webhost2:5121,soadbhost1:5121, soadbhost2:5121"/>
</topology>
</notification-server>

3.  Save and close the file.
4.  Open the ORACLE_HOME/j2ee/OC4J_SOA/config/data-sources.xml file.
5. Add the RAC node information and enable Fast Connection Failover.
<managed-data-source  jndi-name="jdbc/TestDemoDS" description="Managed
DataSource for TestDemoDS"  connection-pool-name="TestDemoDS
Connection Pool" name="TestDemoDS"/>

<connection-pool name="TestDemoDS Connection
Pool" min-connections="10" max-connections="30" inactivity-timeout="30">

 <connection-factory factory-class="oracle.jdbc.pool.OracleDataSource" user="system" password="welcome1" url="jdbc:oracle:oci:@(DESCRIPTION=(LOAD_BALANCE=off) (ADDRESS=(PROTOCOL=TCP)(HOST=infradbhost1.mycompany.com)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=infradbhost2.mycompany.com)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=loon)))"/>
<property name="loginTimeout" value="30"/>
<property name="connectionCachingEnabled" value="true"/>
 <property name="fastConnectionFailoverEnabled" value="true"/>
 </connection-factory>
</connection-pool>
6.   Save and close the file.
7.   Issue this command in ORACLE_HOME/opmn/bin:

      Opmnctl reload

Basics of SOA - XML


Basics of SOA - XML

Before proceeding further to learn SOA, first we have to see what are the basic prerequisite technologies to be learned. The list is as below:
 1) XML
2) XML Schema
3) WSDL
4) XPath
5) XSL
Let us start our journey from XML.
 XML
----------  
  •         XML stands for eXtensible Markup Language and is mainly designed to transport and store data.
  •     XML is a markup language much like HTML but XML tags are not predefined and we can define our own tags
  •          XML is a software- and hardware-independent tool for carrying information

Example XML looks as below:
<?xml version="1.0" encoding="UTF-8"?>
<Letter xmlns=”http://Srini.blogs.com/letter”>
<to>Srini</to>
<from>Vas</from>
<Subject>Hello</Subject>
<body>Hello Everyone !!!</body>
</Letter>
The first line is the XML declaration. It defines the XML version (1.0) and encoding to be used for understanding data in XML.
The next line is Root element i.e  <Letter>
Next 4 lines are the elements inside the root element and so they are called as child of the root element.
Last line ( </Letter>) defines the end of the root element.
After looking in to XML we can say it represents a tree structure which contains parent-child relationship.
Next we will see what are the rules to say an XML is well-formed. The conditions to be satisfied are :
  • All elements must have a closing tag.  Eg: <Letter>…….</Letter>
  • XML tags are case sensitive. The tag <Letter> is different from the tag <letter>
        ·     XML elements must be properly nested. 
                <Letter><From>abc</Letter></From> is illegal    and
                <Letter><From>abc</From></Letter> is correct since tags are properly nested.
  • XML documents must have a root element.

                ·     XML documents must contain one element that is the parent of all other elements. This element is called the root element. In                    our example <Letter> is root element.
  •  XML attribute values must be quoted

<Letter lang=eng>…</Letter> is illegal       and
<Letter lang=”eng”>…</Letter> is correct since attribute value is in quotes.
Let us see some more features of XML below:
  • Comments in XML should be used as <! -- Comment  -- >
  • White space values are preserved in XML. <name>Sri Ni</name> is preserved with space

     Escape characters in XML:
Since XML elements are represented using ‘<’ and ‘>’ if the value of certain element contains ‘<’ or ‘>’ in its value then we need to use escaping to preserve the value correctly.
The below value of body should be as below:
<body> Hello < everyone </body>
‘<’ character in value will be understood as ending tag of body but it is not the one and so to preserve the value we need to write it as below:
<body> Hello &lt; everyone </body>  so that ‘<’ character in value is understood correctly by parser.
Similar list of escape characters are as below:
&lt;
less than
&gt;
greater than
&amp;
&
ampersand 
&apos;
'
apostrophe
&quot;
"
quotation mark

Naming rules for XML element value:
·         Names can contain letters, numbers, and other characters.   Eg:  <bod12y>Srini</ bod12y > is valid.
·         Names cannot start with a number or punctuation character.  Eg: <1body>Srini</1body> is invalid
·         Names cannot start with the letters xml (or XML, or Xml, etc)  Eg: <xmlbody>Srini</ xmlbody > is invalid.
·         Names cannot contain spaces.          Eg: <na me>Srini</na me> is invalid

Namespaces:
In sample XML below, we are defining a namespace xmlns=http://srini.blogs.com/letter
<?xml version="1.0" encoding="UTF-8"?>
<Letter xmlns=”http://Srini.blogs.com/letter”>
<to>Srini</to>
<from>Vas</from>
<Subject>Hello</Subject>
<body>Hello Everyone !!!</body>
</Letter>
This namespace is used to resolve conflicts between same names in different XML.
Let us take one more example XML which shows the conflict.
<?xml version="1.0" encoding="UTF-8"?>
<Letter xmlns=”http://Srini.blogs.com/letter1”>
<reach>Srini</reach>
<sent>Vas</sent>
<Shortmessage>Hello</Shortmessage>
<message>Hello Everyone !!!</message>
</Letter>


If I am using both the above XML in one more XML then I will have a conflict if namespace http://srini.blogs.com/letter   or  http://srini.blogs.com/letter1 are not defined since both are having the same name Letter and we will get a conflict if I refer Letter to which Letter it will exactly refer.