S1AS7的相关文档中暂时缺少关于支持mysql数据库的描述, 以下介绍在S1AS7中配置 MySQL的相关步骤,以供参考。
1. 用"ANSI mode"启动MySQL Server以支持CMP功能.
2. 下载"mysql-connector-Java-3.0.7-stable-bin.jar".
3. 启动S1AS7, 并进入admin console
4. 选择所用的服务器实例的"JVM Settings"
5. 在"Path Setting"的"Classpath Suffix" 增加一行:
//mysql-connector-java-3.0.7-stable-bin.jar
6. 保存,并选择"apply changes"
7. 选择admin console的"JDBC"-"Connection Pools"设置,创建一个新的资源,例如:
* Screen 1:
o Name: "mySQLconPool
o DatabaseVendor: other
* Screen 2:
o Datasource classname: "com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource"
o Properties:
serverName this is the hostname
port usually 3306
databaseName the database you want to connect to
user the mySQL user
passWord the mySQL password
8. 选择"JDBC"-"JDBC Resources",创建一个新的资源,例如:
* JNDI name: jdbc/mysqlds
* Pool name: mySQLconPool
9. 保存改变并重启服务器实例.
10. 应用程序中访问MySQL数据源:
DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/mysqlds");