A relational resource represents a relational database. In the OGSA-DAI server a relational resource manages communications between OGSA-DAI and the actual database. The resource is how the database is exposed to OGSA-DAI clients.
To deploy a relational resource you need to create a relational resource configuration file and then deploy this onto the server and then set up a database login for the clients.
We provide an all-in-one command that will create a relational resource configuration and deploy the resource onto an OGSA-DAI server and also add a database username and password for clients.
First you need to put JARs containing any database driver classes that are not already on the server into a temporary directory.
For example:
$ mkdir tmpResourceDir $ cp some-driver.jar tmpResourceDir/
Now take a copy of the following and save it in a file (e.g. call the
file my.resource.config):
dai.resource.id=RESOURCE_ID dai.db.product=PRODUCT_NAME dai.db.vendor=VENDOR dai.db.version=VERSION dai.db.uri=DATABASE_URI dai.db.driver=DATABASE_DRIVER_CLASS_NAME dai.resource.jar.dir=DATABASE_DRIVER_JAR_DIRECTORY dai.dn=DN dai.user=DATABASE_USER_NAME dai.password=DATABASE_PASSWORD
The values of the entries are as follows:
dai.db.product - optional argument
specifying the database product name.
dai.db.vendor - optional argument
specifying the database product vendor.
dai.db.version - optional argument
specifying the database product version.
dai.db.uri - database connection URI.
The full connection URI is required. e.g. the following are examples
of correctly-formatted connection URIs:
jdbc:mysql://myhost:3306/daitest jdbc:db2://myhost:50000/ogsadai jdbc:microsoft:sqlserver://myhost:1433;DatabaseName=ogsadai jdbc:oracle:thin:@myhost:1521:ogsadai jdbc:postgresql://myhost:5432/ogsadai
dai.db.driver - database driver
class name. The full class name is required. e.g. the following are
examples of correctly-formatted class names:
org.gjt.mm.mysql.Driver com.ibm.db2.jcc.DB2Driver com.microsoft.jdbc.sqlserver.SQLServerDriver oracle.jdbc.driver.OracleDriver org.postgresql.Driver
dai.resource.id - data resource
ID. The ID of the data resource that exposes the relational
directory. The resource configuration file will have this ID as its name.
dai.dn - a credential, attribute
or distinguished name. Clients may provide these and these need to be
mapped to database usernames and passwords. Here are a couple of
examples of credentials:
/C=US/O=Music/OU=Band/L=Bangles/CN=susanna hoffs EMAILADDRESS=shoffds@bangles.com, CN=test.ogsadai.org.uk, OU=Band, O=Music, L=Bagles, ST=Scotland, C=UK"
![]() | Note |
|---|---|
If you are not using security them either omit this option from your
file or use the value ANY.
|
dai.user - username compliant
with the database exposed by the data resource whose ID is the
value of dai.resource.iddai.password - password associated
with the above username.
For example:
dai.resource.id=MySQLDataResource dai.db.product=MySQL dai.db.vendor=MySQL dai.db.version=5 dai.db.uri=jdbc:mysql://somehost:3306/daitest dai.db.driver=org.gjt.mm.mysql.Driver dai.dn="/C=US/O=Music/OU=Band/L=Bangles/CN=susanna hoffs" dai.resource.jar.dir=tmpResourceDir dai.user=someDBUser dai.password=123xyz456
Now, run the deployRelationalResource
command. This takes the following arguments:
-propertyfile - path to your
property file.
If using Tomcat, run:
$ ant -propertyfile FILE -Dtomcat.dir=$CATALINA_HOME deployRelationalResource
For example
$ ant -propertyfile my.resource.config -Dtomcat.dir=$CATALINA_HOME deployRelationalResource
If using the Globus Toolkit container, run:
$ ant -propertyfile FILE -Dgt.dir=$GLOBUS_LOCATION -Ddai.target.gt=true deployRelationalResource
![]() | Note |
|---|---|
Note that this takes an argument,
dai.target.gt which has value
true. This is so the command knows
that the Globus Toolkit container and not Tomcat is being used.
|
For example
$ ant -propertyfile my.resource.config -Dgt.dir=$GLOBUS_LOCATION -Ddai.target.gt=true deployRelationalResource
This command copies the configuration file for the resource onto the
OGSA-DAI server.
The server's resource configuration files are located in:
if using Tomcat.
if using Globus Toolkit container.
if using Tomcat.
if using Globus Toolkit container.
if using Tomcat.
if using Globus Toolkit container.
$CATALINA_HOME/webapps/wsrf/WEB-INF/etc/dai/resources/
$GLOBUS_LOCATION/etc/dai/resources/
$CATALINA_HOME/webapps/wsrf/WEB-INF/lib/
$GLOBUS_LOCATION/lib/
$CATALINA_HOME/webapps/wsrf/WEB-INF/etc/dai/logins.txt
$GLOBUS_LOCATION/etc/dai/logins.txt
![]() | Note |
|---|---|
The properties file is not the same as an OGSA-DAI resource
configuration file. It is used as a convenience to save providing a
number of command-line options. As a side-effect of running this
command you will find a resource configuration file in your home
directory which has the name of your resource e.g. for the example
above this would have name
MySQLDataResource. This is suitable
for use with the general
deployResource command which is
described in Section 42.3, “Deploy a relational resource”.
|
To check your resource has deployed correctly you could use our Chapter 71, Example relational data resource client. We also have an example client that supports the use of Globus Toolkit security - see Chapter 72, Example relational data resource client using GT security.
![]() | Tip |
|---|---|
| As an alternative to specifying the arguments at the command-line you could use an ANT property file - see the FAQ Section N.3, “How can I avoid specifing lots of properties for ANT targets at the command-line?”. |
![]() | Tip |
|---|---|
| If you wish to create a resource configuration file but not deploy it then please see Section 42.2, “Create a relational resource configuration file” |
![]() | Tip |
|---|---|
| If you wish to deploy an existing resource configuration file then please see Section 42.3, “Deploy a relational resource” |
![]() | Tip |
|---|---|
| If you wish to add more database logins for clients for your resource then please see the page on Chapter 44, How to add a database login for a client |
To create an relational resource configuration file run the
createRelationalConfig command. This
takes the following arguments:
dai.db.product - optional argument
specifying the database product name.
dai.db.vendor - optional argument
specifying the database product vendor.
dai.db.version - optional argument
specifying the database product version.
dai.db.uri - database connection URI.
The full connection URI is required. e.g. the following are examples
of correctly-formatted connection URIs:
jdbc:mysql://myhost:3306/daitest jdbc:db2://myhost:50000/ogsadai jdbc:microsoft:sqlserver://myhost:1433;DatabaseName=ogsadai jdbc:oracle:thin:@myhost:1521:ogsadai jdbc:postgresql://myhost:5432/ogsadai
dai.db.driver - database driver
class name. The full class name is required. e.g. the following are
examples of correctly-formatted class names:
org.gjt.mm.mysql.Driver com.ibm.db2.jcc.DB2Driver com.microsoft.jdbc.sqlserver.SQLServerDriver oracle.jdbc.driver.OracleDriver org.postgresql.Driver
dai.resource.id - data resource
ID. The ID of the data resource that exposes the relational
directory. The resource configuration file will have this ID as its name.
$ ant -Ddai.db.product=PRODUCT \ -Ddai.db.vendor=VENDOR \ -Ddai.db.version=VERSION \ -Ddai.db.uri=DATABASE-URI \ -Ddai.db.driver=DATABASE-DRIVER-CLASS \ -Ddai.resource.id=RESOURCE-ID createRelationalConfig
For example:
$ ant -Ddai.db.product=MySQL \ -Ddai.db.vendor=MySQL \ -Ddai.db.version=5 \ -Ddai.db.uri=jdbc:mysql://coal.epcc.ed.ac.uk:3306/daitest \ -Ddai.db.driver=org.gjt.mm.mysql.Driver \ -Ddai.resource.id=MySQLDataResource \ createRelationalConfig
![]() | Tip |
|---|---|
| As an alternative to specifying the arguments at the command-line you could use an ANT property file - see the FAQ Section N.3, “How can I avoid specifing lots of properties for ANT targets at the command-line?”. |
Now, to deploy the resource onto the OGSA-DAI server, first you need to put JARs containing any database driver classes that are not already on the server into a temporary directory.
For example:
$ mkdir tmpResourceDir $ cp some-driver.jar tmpResourceDir/
To deploy the resource onto the OGSA-DAI server, run the
deployResource command which takes
the following arguments:
dai.resource.file - the path
to your resource configuration file.
dai.resource.jar.dir - location of
directory containing any required database driver JARs and resource
implementation JARs. If all the required JARs are already on the
server then this value can be omitted.
If using Tomcat, run:
$ ant -Dtomcat.dir=$CATALINA_HOME \ -Ddai.resource.jar.dir=DIRECTORY \ -Ddai.resource.file=RESOURCE-FILE \ deployResource
For example
$ ant -Dtomcat.dir=$CATALINA_HOME \ -Ddai.resource.jar.dir=tmpResourceDir \ -Ddai.resource.file=/home/user/MySQLDataResource \ deployResource
If using the Globus Toolkit container, run:
$ ant -Dgt.dir=$GLOBUS_LOCATION \ -Ddai.resource.jar.dir=DIRECTORY \ -Ddai.target.gt=true \ -Ddai.resource.file=RESOURCE-FILE \ deployResource
![]() | Note |
|---|---|
Note that this takes an argument,
dai.target.gt which has value
true. This is so the command knows
that the Globus Toolkit container and not Tomcat is being used.
|
For example
$ ant -Dgt.dir=$GLOBUS_LOCATION \ -Ddai.resource.jar.dir=tmpResourceDir \ -Ddai.target.gt=true \ -Ddai.resource.file=/home/user/MySQLDataResource \ deployResource
This command copies the configuration file for the resource onto the
OGSA-DAI server.
The server's resource configuration files are located in:
if using Tomcat.
if using Globus Toolkit container.
if using Tomcat.
if using Globus Toolkit container.
$CATALINA_HOME/webapps/wsrf/WEB-INF/etc/dai/resources/
$GLOBUS_LOCATION/etc/dai/resources/
$CATALINA_HOME/webapps/wsrf/WEB-INF/lib/
$GLOBUS_LOCATION/lib/
You will now need to add at least one database login for the resource - see Chapter 44, How to add a database login for a client.
![]() | Tip |
|---|---|
| As an alternative to specifying the arguments at the command-line you could use an ANT property file - see the FAQ Section N.3, “How can I avoid specifing lots of properties for ANT targets at the command-line?”. |