Following article is about two different database /directory connection techniques that can be used in a client server or e commerce environment. Focus here is on brief overview and a sample of each technique,  rather than the architecture.

Sqlxml 
  SqlXml Gives ability to do curd operations using xml over http for databases (Oracle, Ms) . It is an easy to setup and only needs the database and web server. But best use to get an xml output from a sql query over http due to security concerns.
oracle’s provides this feature using  xsql servlet in a servlet container like tomcat. Similarly with Ms Sql server this feature is available with IIS (Internet information server).
Following is sample template for IIS.
<Root xmlns:sql=”urn:schemas-microsoft-com:xml-sql”>
<sql:header>
<sql:param name=”YEAR”></sql:param>
</sql:header>
<sql:query>
select ac,amt
from costcenter
WHERE year = @YEAR 
FOR XML RAW ,XMLDATA
</sql:query>
</Root>

JNDI
 The Java Naming and Directory InterfaceTM (JNDI) is an application programming interface (API) that provides naming and directory functionality to applications written using the JavaTM programming language. It is defined to be independent of any specific directory service implementation.
      In following a java base application residing in tomcat use AD (active directory) to authenticate its users. This is useful in an intranet and extranet application. Example if the contractors working for a company is given AD accounts and roles to grant various access rights.
   following sample connection string in server.xml helps to establish the connection with AD.

<Realm className=”org.apache.catalina.realm.JNDIRealm” debug=”99″ connectionURL=”ldap://ldapserver:port” userBase=”OU= Contractors ,DC=..” userSearch=”(sAMAccountName={0})” userRoleName=”member” roleBase=”OU= Contractors,DC=…” roleName=”CN” roleSearch=”member={0}” connectionName=”CN=User,CN=Users,DC=..” connectionPassword=”xxx” roleSubtree=”true” userSubtree=”true” />
Then in web.xml file of the application use the relevant security roles and constraints from AD to authenticate users.

Conclusion
 New Data connection techniques emerge all the time in client server environment.  Table adapter and Linq are two such techniques. Some of these techniques help abstraction of data layer from others quite well. For example Table adapter followers table data gateway design pattern described by Martin Flower.

Advertisement