Java Reference
In-Depth Information
USE juddiDB;
Here you are going to use MySQL in batch mode to process this collection of SQL statements
all at once. Using the < sign indicates this to the server:
$ mysql -h localhost
-u root -p < /home/ehewitt/mysql/create-juddi-db.sql
This will create the database, add the tables, and put a publisher in it. You can now run a
simple query to make sure your publisher exists:
$ mysql -u juddi -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 50
Server version: 5.0.22
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> use juddiDB; select * from PUBLISHER;
If you see the data you inserted into the database before, you're in business.
Setting up a Tomcat datasource
Now that the database is set up, let's create a Tomcat datasource for it so that the web applic-
ation can use it.
Get the MySQL JDBC driver (Connector/J) from http://dev.mysql.com/downloads/connector .
I am using mysql-connector-java-5.0.6-bin.jar. Install the .jarfile containing the JDBC driver
in Tomcat's <tomcat-home>/libfolder.
NOTE
There is already a <resource-ref> element set up in the web.xmlfile for jUDDI, so you don't
need to add that.
You'll now create a datasource called jdbc/juddiDB . Navigate to the <tomcat-home>/juddi/
META-INFdirectory in the exploded WAR. Create a file called context.xml. This will hold
your datasource information for connecting with Tomcat. If you're using a different container,
just set up the datasource as you normally would using the same properties here. In the file,
type the following:
<?xml version="1.0" encoding="UTF-8"?>
<Context>
Search WWH ::




Custom Search