Run Shark with MySQL

来源:互联网 发布:立邦工作环境知乎 编辑:程序博客网 时间:2024/04/28 07:29

**************************************************
*** How to run Shark with MySQL                   ***
**************************************************

##################################################
### 从cvs上下载的最新的Shark程序
##################################################
cvs -d:pserver:anonymous@cvs.forge.objectweb.org:/cvsroot/shark login
cvs -z3 -d:pserver:anonymous@cvs.forge.objectweb.org:/cvsroot/shark co modulename
######
#Note:
######
This project's CVS repository can be checked out through anonymous (pserver) CVS with
the following instruction set. The module you wish to check out must be specified as
the modulename (if you don't know which module is defined or if no module is set, just
remplace modulename by .). When prompted for a password for anonymous, simply press the
Enter key.
######
#Note:
######
下载下来的Shark程序存放目录用%Shark%表示

##################################################
### Shark目前所支持的数据库
##################################################
1、db2
2、hsql
3、informix
4、msql
5、mysql
6、oracle
7、postgresql
8、sybase

##################################################
### 配置Shark支持MySQL数据库
##################################################
在%Shark%/input目录下面有一个configure.properties文件,修改该文件使Shark可以在MySQL上运行。
打开该文件,修改“db_loader_job=hsql”为“db_loader_job=mysql”;查找“db_ext_dirs”小节,该小节
指明所用数据库的JDBC驱动程序所在的位置,如果你把JDBC驱动程序拷贝到%Shark%/lib目录下的话,
这个小节的配置可以不用修改,即设置为“db_ext_dirs=”。

查找“MySQL”小节,修改该小节中的驱动程序名、数据库连接字符串以及访问数据库的用户和密码,如下:
--------------------------------------------------------------------------------
# MySQL
mysql_JdbcDriver=com.mysql.jdbc.Driver
mysql_Connection_Url=jdbc:mysql://localhost:3306/shark
mysql_user=shark
mysql_passwd=shark
--------------------------------------------------------------------------------

修改完上面提到的参数后,一定要把“use_cache=”这个配置修改为“use_cache=#”或者注释掉这个配置,
如果不作修改的话,Shark将不会使用我们配置的数据库。

configure.properties文件中的其他配置可以采用默认的值。


##################################################
### 创建Shark需要的MySQL数据库、用户
##################################################
mysql>create database shark;
mysql>grant all on *.* to shark@localhost identified by 'shark' with grant option;

###########################################################
### 编译Shark程序(注意:一定要把JDBC驱动程序放在适当的位置)
###########################################################
在%Shark%目录下,执行configure -help可以看到Shark的配置参数,可以利用configure命令指定编译
用的JDK的安装路径以及编译好的Shark程序安装在何处。如我使用如下的configure命令来指明:
$configure -jdkhome c:/j2sdk1.4.1 -instdir C:/Shark-1.0

使用configure命令设置好JDK环境和安装环境后,可以用make –help查看Shark提供的编译选项,一般情况
下我们选择全部编译,即使用如下的编译命令:
$make buildAll

编译Shark程序成功后,我们可以使用make install命令把编译好的Shark可执行程序安装到configure是指定
的安装目录。

至此,Shark和MySQL的结合工作已经做完,接下来我们将检查我们的工作是否成功。


##################################################
### 测试 Shark+MySQL 程序
##################################################
1、首先查看Shark程序是否已经在MySQL中生成了需要的表,如下:

C:/Documents and Settings/Administrator>mysql -ushark -p
Enter password: *****
Welcome to the MySQL monitor.  Commands end with ; or /g.
Your MySQL connection id is 2 to server version: 4.1.14-nt

Type 'help;' or '/h' for help. Type '/c' to clear the buffer.

mysql> use shark;
Database changed
mysql> show tables;
+--------------------------------------------+
| Tables_in_shark                             |
+--------------------------------------------+
| activities                                            |
| activitydata                                        |
| activitydatablobs                              |
| activitydatawob                                |
| activitystateeventaudits                  |
| activitystates                                     |
| andjointable                                     |
| assignmenteventaudits                 |
| assignmentstable                           |
|    .............                                            |
| toolagentuser                                   |
| usergrouptable                                |
| userpacklevelparticipant               |
| userproclevelparticipant                |
| usertable                                          |
| xpdlapplicationpackage                |
| xpdlapplicationprocess                 |
| xpdldata                                            |
| xpdlhistory                                        |
| xpdlhistorydata                                |
| xpdlparticipantpackage                 |
| xpdlparticipantprocess                  |
| xpdlreferences                                |
| xpdls                                                 |
+-------------------------------------------+

69 rows in set (0.36 sec)
mysql>

从上面的数据库数据中可以看出,Shark程序在编译的时候已经和MySQL结合在一起了,接
下来我们按照%Shark%/doc/EnhydraShark_Quick_Start.html的说明来测试Shark程序。

2、按照快速指南测试Shark程序。
------省略------

参看资料:
1、http://shark.objectweb.org/doc/sfs/sharkfromscratch1appendix.html
2、http://shark.objectweb.org/doc/sfs/sharkfromscratch1.html

原创粉丝点击