自己紹介
|
|
Sakila (MySQL イルカ) 写真集
Navigation
Glassfish Web Space ServerのデータベースをMySQLに
02.17.2009 | 0 投稿されたコメント
前回、Web Space Server をインストールしましたが、次は、レポジトリを MySQL に変えてみたいと思います。Web Space Server はデフォルトでは HSQL を利用するようになっていますので、これを以下のドキュメントに従いながら進めます。
Sun GlassFish Web Space Server 10.0 Administration Guide
2. Installation and Configuration
http://docs.sun.com/app/docs/doc/820-7054/ghzly?a=view
どこかから MySQL の環境を探して(なければインストールして)ユーザとデータベースを以下のように作成します。
mysql> create database lportal default character set utf8
mysql> use lportal;
mysql> create user lportal;
mysql> grant all privileges on *.* to 'lportal'@'localhost' identified by 'lportal';
mysql> set password for 'lportal'@'localhost' = password('lportal');
次に、作業ディレクトリ(ここでは仮に C:\moriyaDemo\tmp\wstest を用意して、
[WebSpaceRoot](ここでは C:\moriyaDemo\webspace10)\glassfish2\domains\domain1\applications\j2ee-modules\webspace\WEB-INF\lib の中から portal-impl.jar を作業ディレクトリにコピー。
そして展開。
jar xf portal-impl.jar展開した中から portal.properties を探し、その中から
## ## JDBC ##で始まる一連の設定項目を portal-ext.properties という名の新規ファイルにコピー。
(既にファイルが存在する場合は既存のファイルをリネームしておくと良いかもしれない)
Hypersonic(HSQL) の部分をコメントアウトして、MySQL の部分を以下のように設定。
##
## JDBC
##
#
# Set the JDBC properties to configure how Liferay connects to the database
# server. Liferay is database agnostic and can connect to a number of
# different database servers.
#
(中略)
#
# Hypersonic
#
#jdbc.default.driverClassName=org.hsqldb.jdbcDriver
#jdbc.default.url=jdbc:hsqldb:${liferay.home}/data/hsql/lportal
#jdbc.default.username=sa
#jdbc.default.password=
#
# MySQL
#
jdbc.default.driverClassName=com.mysql.jdbc.Driver
jdbc.default.url=jdbc:mysql://localhost/lportal?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false
jdbc.default.username=lportal
jdbc.default.password=lportal
#
# Oracle
#
(中略)
#
# Liferay uses C3PO by default for connection pooling. The data source
# factory can be configured to use JNDI or another pooling implementation by
# modifying infrastructure-spring.xml. See
# http://www.mchange.com/projects/c3p0/index.html#configuration for a list
# of additional fields used by C3PO for configuring the database connection.
#
jdbc.default.maxPoolSize=50
jdbc.default.minPoolSize=5
作った portal-ext.properties ファイルを [WebSpaceRoot]\var\webspace\war-workspace\customs\webspace\WEB-INF\classes 配下にコピー。
[WebSpaceRoot]\var\webspace\war-workspace に移動し、以下のように ant を実行。
ant -f synchronize.xml
MySQL の JDBC ドライバ(mysql-connector-java-3.1.13-bin.jar)を以下のディレクトリに配置。
[WebSpaceRoot]\glassfish2\domains\domain1\applications\j2ee-modules\webspace\WEB-INF\lib
Glassfish を再起動。
すると、色々テーブルが自動的に作成されます。