Running multiple application instances with Orion

2000-10-31 Thread Kurt Hoyt

I've put together a how-to on running the same J2EE application, but with
each instance using a different data source, using Orion. It would be nice
if there was a simpler way to do this (particularly in associating data
sources with applications, which causes the bulk of the work).

If the orionsupport.com folks are listening, you have my permission to add
this to your site (just be sure to give credit where due).

Kurt in Atlanta


Title: Running Multiple Application Instances with Orion



Running Multiple Application Instances with Orion


Kurt Hoyt ([EMAIL PROTECTED])


This document assumes you know how to create an EJB .jar file, a web
application's .war file, and a J2EE application's .ear file. All this document
does is describe the changes you need to make in order to run multiple instances
of the same application within the same instance of Orion (one JVM running
on one computer), with each instance using its own data source.


The data-sources.xml file


Create the data source entry in Orion’s config/data-sources.xml file. Here are the two
data sources I created, one for SQL Server and one for Oracle:


   data-source
  class="com.evermind.sql.DriverManagerDataSource"
  name="SQLServer"
  schema="database-schemas/ms-sql.xml"
  location="jdbc/SQLServerCoreDS"
  xa-location="jdbc/xa/SQLServerXADS"
  ejb-location="jdbc/SQLServerDS"
  connection-driver="com.inet.tds.TdsDriver"
  username="orion"
  password="orion"
  url="jdbc:inetdae7:SQLServerHost:1433?database=orion"
  inactivity-timeout="30"
   /
   data-source
  class="com.evermind.sql.DriverManagerDataSource"
  name="Oracle"
  schema="database-schemas/oracle.xml"
  location="jdbc/OracleCoreDS"
  xa-location="jdbc/xa/OracleXADS"
  ejb-location=jdbc/OracleDS"
  connection-driver="oracle.jdbc.driver.OracleDriver"
  username="orion"
  password="orion"
  url="jdbc:oracle:thin:@OracleHost:1521:orionora"
  inactivity-timeout="30"
   /


Notice that the ejb-locations are different between the two
data sources. Each data source will need a unique ejb-location (and the other
locations). Notice the naming convention: jdbc/some-nameDS for the
ejb-location, jdbc/some-nameCoreDS for the location, and
jdbc/xa/some-nameXADS for the xa-location (xa = transactional). There
is also a pooled-location that can be used if the data source needs to be
accessed from outside the EJB server (like inside a JSP).


It’s the ejb-location that you’ll need for the orion-ejb-jar.xml file. There will be
a 1:1 relationship between each application instance and its data source.


The orion-ejb-jar.xml file


Once you have a data source set up, you have to tell Orion to use that data source
for the tables it creates for the entity beans in the EJB jar file (which I’ll
call “myapp-ejb.jar” for discussion purposes). You do that by editing the
orion/orion-ejb-jar.xml file that you’ll put inside the myapp-ejb.jar file.
This means that you will have a different myapp-ejb.jar file for each
application instance, with the only difference being the contents of the
orion-ejb-jar.xml file.


For each entity bean, you tell Orion which data source from the
config/data-sources.xml file to use:



   entity-deployment name="Customer" table="Customer" data-source="jdbc/OracleDS"
   .
   .
   .
   /entity-deployment



This is the skeleton for the Oracle version of the Content
entity bean deployment. The entity-deployment tag sits inside the
enterprise-beans tag inside the orion-ejb-jar tag inside the
orion-ejb-jar.xml file. Notice the data-source attribute in the
entity-deployment tag. That’s how the connection is made. The
data-source attribute must be set for each entity bean, so each entity bean
must represented with an entity-deployment tag inside the file. For SQL
Server, the same skeleton looks like this:



   entity-deployment name="Customer" table="Customer" data-source="jdbc/SQLServerDS"
   .
   .
   .
   /entity-deployment


You can see how each version uses a different data source.


I saved the Oracle version in a file called oracle-orion-ejb-jar.xml and the SQL
Server version in a file called sqlserver-orion-ejb-jar.xml. It should be
simple to create some kind of database-neutral skeletons that could be run
through some filter program that would assign the data source for you.


Build the myapp-ejb.jar file


To build the myapp-ejb.jar file, you need to have this directory structure
somewhere:


   mypackage/*.class (the EJB remote, home and bean classes)
   META-INF/ejb-jar.xml
   orion/orion-ejb-jar.xml


Once you have that structure, you can use the jar program to create the EJB jar file:


   jar cvf myapp-ejb.j

Re: Running multiple application instances with Orion

2000-10-31 Thread Robert Krueger


checkout my mail from earlier today regarding datasource aliases. that 
makes things a little easier (i.e. only one change in the deployment of the 
app instead of several in all the entity beans and other resource-ref 
mappings).

regards,

robert

At 08:07 31.10.00 , you wrote:
I've put together a how-to on running the same J2EE application, but with
each instance using a different data source, using Orion. It would be nice
if there was a simpler way to do this (particularly in associating data
sources with applications, which causes the bulk of the work).

If the orionsupport.com folks are listening, you have my permission to add
this to your site (just be sure to give credit where due).

Kurt in Atlanta


(-) Robert Krüger
(-) SIGNAL 7 Gesellschaft für Informationstechnologie mbH
(-) Brüder-Knauß-Str. 79 - 64285 Darmstadt,
(-) Tel: 06151 665401, Fax: 06151 665373
(-) [EMAIL PROTECTED], www.signal7.de





Re: Running multiple application instances with Orion

2000-10-31 Thread Joe Walnes

Kurt,

Thank you for this article - it has been published on OrionSupport.

A comment I have, is that instead of specifying a data-source for *every* 
entity-deployment in orion-ejb-jar.xml, you can specify a 
default-data-source in orion-application.xml which will automatically be 
used by every cmp entity in the entire application.

Likewise, orion-application.xml also allows you to specify a 
data-sources.xml file to be used for the specific application - this allows 
you to separate configuration of data-sources in each applications.

-Joe Walnes

At 16:07 31/10/2000, Kurt Hoyt wrote:
I've put together a how-to on running the same J2EE application, but with
each instance using a different data source, using Orion. It would be nice
if there was a simpler way to do this (particularly in associating data
sources with applications, which causes the bulk of the work).

If the orionsupport.com folks are listening, you have my permission to add
this to your site (just be sure to give credit where due).

Kurt in Atlanta