GERONIMO データソースの作成
指定されたパートは存在しません。
[GERONIMO]
ver 1.1.1
Tomcatの場合
- まず、GERONIMO のリポジトリに、JDBCドライバを登録する必要がある。メニューからCommon Libsを選択
- GERONIMO/repository ディレクトリ以下の構成にならって、各項目を設定し、Install
- Database poolの作成
- Database pool wizerd を起動
- Oracle Express EditionのDatabase poolを作成
- さっき登録したJDBC情報を選択し、ユーザ、パスワード等必要な情報を設定
- Deployする
- 新しいDatabase poolが作成された
- 右のほうのusageを選択すると、使用法が書いてある。
WEB-INF/web.xmlに以下を追記
<resource-ref> <res-ref-name>jdbc/fugitive</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> <res-sharing-scope>Shareable</res-sharing-scope> </resource-ref>
WEB-INF/geronimo-web.xml を作成し、以下を記述
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.1"> <environment> <moduleId> <artifactId>fugitive</artifactId> </moduleId> <dependencies> <dependency> <groupId>console.dbpool</groupId> <artifactId>Fugitive</artifactId> </dependency> </dependencies> </environment> <context-root>/fugitive</context-root> <!-- security settings, if any, go here --> <resource-ref> <ref-name>jdbc/fugitive</ref-name> <pattern> <groupId>console.dbpool</groupId> <artifactId>Fugitive</artifactId> <name>Fugitive</name> </pattern> </resource-ref> </web-app>
- アプリケーションから利用
InitialContext ctx = new InitialContext(); DataSource ds = ctx.lookup("java:comp/env/jdbc/fugitive");
指定されたパートは存在しません。
YAGI Hiroto (piroto@a-net.email.ne.jp)
twitter http://twitter.com/pppiroto
Copyright© 矢木 浩人 All Rights Reserved.