- 浏览: 526294 次
- 性别:
- 来自: 广州
最新评论
-
shitouofIT:
...
Spring Autowired(required = false) 说明 -
liuchongming:
...
Spring Autowired(required = false) 说明 -
20101975liubin:
...
Spring Autowired(required = false) 说明 -
ghpaas:
orbeon作为xforms标准的实现,不论其设计器还是运行时 ...
Eclipse 下安装 Visual XForms Designer 插件 -
young.java:
[flash=200,200][url][img][list] ...
利用JS生成32位的UUID(源码)
Creating a MySQL data source using WebSphere Application Server
- 博客分类:
- 技术
DATABASE CONNECTIVITY
Recently, Senior Technical Editor Dan Velasco wrote an article on how to connect to the popular open source database MySQL from WebSphere Studio Application Developer (see http://www.webspherepower.com/issues/issue200310/00001111001.html). Once you've created your application using MySQL, though, you'll want to deploy it to an application server, presumably WebSphere Application Server. To use MySQL on the application server, you will need to create a JDBC (Java Data Base Connectivity) data source if you want to take advantage of the connection pooling capabilities inherent in the WebSphere platform.
Creating a JDBC MySQL data source involves three independent steps, all accomplished with the WebSphere Application Server's Administrative Console facility. In order, these three steps are:
- Create a MySQL JDBC provider.
- Create the basic MySQL data source configuration.
- Add six custom properties to the MySQL data source configuration.
We'll walk through each of these steps, one step at a time.
Open the WebSphere Application Server Administrative Console
JDBC data sources are created in the WebSphere Application Server using the built-in Administrative Console, a Struts 1.0 application that comes bundled with the product. To activate the Administrative Console, open a Web browser and enter the following URL:
https://<;server-name>:9043/admin
Figure A illustrates the screen that will come up if all is working correctly with your application server and the Administrative Console has been enabled.
FIGURE A
Log into your Administrative Console. Roll over picture for a larger image.
If you have security turned on for the Administrative Console, the screen will also contain a password field and you will have to enter a valid user name and password to authenticate to the server. If you do not have security turned on, you can enter any username that you wish. Once you authenticate to the server, you will see the home page of the Administrative Console, depicted in Figure B.
FIGURE B
Welcome home. Roll over picture for a larger image.
Create the JDBC provider
The first step in creating the Data Source is to create the MySQL JDBC provider. Open up the Resources menu by clicking on the little plus sign (+) in front of the word Resources and then click on JDBC Providers. This should bring you to the screen found in Figure C.
Creating a MySQL data source using WebSphere Application Server (continued)
FIGURE C
Click New to create a providers. Roll over picture for a larger image.
Click on the New button, which should bring you to the JDBC Provider Configuration entry screen, shown in Figure D.
FIGURE D
Configure your new provider. Roll over picture for a larger image.
Enter the JDBC Provider configuration parameters using the following information:
- Name: MySQL
- Description: MySQL JDBC 2.0-compliant Provider configuration
- Classpath: ${User-defined_JDBC_DRIVER_PATH}/mysql-connector-java-3.0.9-stable-bin.jar (or the appropriate name for the version of MySQL Connector/J that you are using)
- Native Library Path: <leave blank>
- Implementation Classname: com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource
When you have finished entering the data, click on OK. If there are no data entry errors, this should take you back to the list of JDBC Providers, where you should now see your new MySQL JDBC Provider displayed as shown in Figure E.
FIGURE E
You're now the proud owner of a new provider. Roll over picture for a larger image.
You should also see a message at the top of the screen informing you that changes have been made and indicating that you should save these changes to the Master Configuration. While you can take that step at this point, we will be making further changes and you might as well wait until everything has been completed and then save everything at once.
"The secret trick to making this work is the Datasource Helper Classname" |
Create the base JDBC data source entry
Click on the name of your new MySQL JDBC Provider entry to return to the JDBC Provider Configuration screen. Scroll to the bottom of the screen and click on the Data Sources link in the Additional Properties section, as shown in Figure F.
FIGURE F
Scroll down for the Additional Properties section. Roll over picture for a larger image.
This should take you to the empty Data Sources list shown Figure G, where you need to click on the New button.
FIGURE G
Click new to create a new data source. Roll over picture for a larger image.
This will bring you to the Data Source Configuration screen, shown in Figure H.
FIGURE H
Enter the Data Source configuration parameters. Roll over picture for a larger image.
Enter the Data Source configuration parameters using the following information:
- Name: <data source name>
- JNDI (Java Naming and Directory Interface) Name: jdbc/<data source name>
- Description: <data source description>
- Statement Cache Size: 10 (the default)
- Category: <leave blank>
- Datasource Helper Classname: com.ibm.websphere.rsadapter.ConnectJDBCDataStoreHelper
- Component-managed Authentication Alias: <leave blank>
- Container-managed Authentication Alias: <leave blank>
The secret (and not very well publicized) trick to making this work is the Datasource Helper Classname. Without the proper datasource helper, you will run into all kinds of interesting challenges trying to get this to work.
When you have finished entering the data, click on OK. If there are no data entry errors, this should take you back to the list of JDBC data sources, where you should now see your new MySQL JDBC data source displayed, shown in Figure I.
Creating a MySQL data source using WebSphere Application Server (continued)
FIGURE I
Here's your new data source. Roll over picture for a larger image.
Add MySQL-specific custom properties to your data source entry
Click on the name of your new MySQL JDBC data source entry to return to the JDBC data source configuration screen. Scroll to the bottom of the screen as shown in Figure J and click on the Custom Properties link in the Additional Properties section.
FIGURE J
Get ready to configure some custom properties. Roll over picture for a larger image.
This should take you to the empty Custom Properties list, shown in Figure K, where you can begin entering the six custom properties necessary to complete your MySQL Data Source entry.
FIGURE K
Now you can configure some hidden, but very important options. Roll over picture for a larger image.
The six custom properties, which are another difficult to locate tidbit of critical information, and their respective values are:
Name | Type | Value |
databaseName | java.lang.String | <database-name>?autoReconnect=true |
factory | java.lang.String | com.mysql.jdbc.jdbc2.optional.MysqlDataSourceFactory |
password | java.lang.String | <password> |
port | java.lang.String | 3306 (or your MySQL port, if you have changed it) |
serverName | java.lang.String | <server=name> |
user | java.lang.String | <user-name> |
Custom properties are entered one property at a time using the Custom Property Configuration screen. To enter your first property, click on the New button above the empty property list, which should take you to the Custom Property Configuration screen illustrated in Figure L.
FIGURE L
Enter the property name, Java type, and property value, then click OK Roll over picture for a larger image.
Enter the property name, Java type, and property value, then click OK. Repeat this process for all six of the properties listed above.
When you have completed entering all of the custom properties, the last step is to save all of the changes that you have made to the master configuration. After successfully entering the data for the last custom property, you should still be on the list of custom properties for your new data source, as shown in Figure M.
FIGURE M
Here you can see all your custom properties Roll over picture for a larger image.
At the top of the screen, you should still see the message about saving your changes to Master Configuration. Clicking on the word Save in that message will take you to the Save to the Master Configuration screen shown in Figure N.
FIGURE N
Don't forget to save your configuration. Roll over picture for a larger image.
Click on the Save button to save your newly completed MySQL JDBC data source configuration and you are ready to start using your new data source.
Wrap-up
By following these three simple steps, you can create your first MySQL JDBC data source. If you need additional MySQL data sources in the same server instance, creating the rest is even easier. Step one, creating the MySQL JDBC Provider only has to be done once per server; additional data sources can be added using the same provider by just completing steps two and three. Just make sure that your .jar file for the MySQL JDBC driver is accessible to the server and your new data source should be ready to go.
发表评论
-
android 各种权限 permission 列举
2013-05-28 11:48 1404在Android的设计中,资源的访问或者网络连接,要得到这 ... -
java 判断程序是否正在运行
2011-08-18 18:02 4238public class ProcessBuilder ... -
Spring Autowired(required = false) 说明
2011-07-21 15:29 79321当候选 Bean 数目不为 1 时的应对方法 ... -
ProcessBuilder实现Java应用程序自我重启
2011-07-12 20:01 2733程序运行的过程中,我们可能需要更改一些配置,如果配置 ... -
Spring获取Bean常用方式
2011-07-05 16:42 1858方法一:在初始化时创建ApplicationContex ... -
Java 利用线程池创建并发线程
2011-07-05 16:25 2219import java.util.concurrent. ... -
Java 超时线程控制实现
2011-07-05 16:11 9523在Java中,如果需要设定代码执行的最长时间,即超 ... -
Java 对比两字符串的相似度
2011-07-05 16:03 4137/** * 编辑距离算法,首先由俄国科学家Levensh ... -
Oracle session process lock
2011-05-26 10:30 1782须以Oracle 数据库 system 权限账户登录 ... -
Java 识别字符编码
2011-05-26 10:25 2085public class EncodingUtils { ... -
数据库主键设置为全局唯一方案
2011-04-25 15:09 2477现在通过数据的水平切分(sharding)来实现数据库 Sca ... -
JS验证浏览器端是否安装某插件
2011-04-14 14:01 2241<HTML> <HEAD><sc ... -
利用JS生成32位的UUID(源码)
2011-02-15 16:23 17525创建 UUID.js 文件, 然后复制以下内容: // ... -
Java 日期字符串date与数字long之间的转换
2010-11-30 14:32 50555public class SimpleDateUtil { ... -
Hibernate Annotation 使用说明
2010-09-25 14:18 2457/** * 注释说明: ... -
svn 如何开启用户可编辑log message的权限
2010-07-15 15:38 55291. 首先进入svn 安装目录下找到 hooks 目录, ... -
Myeclipse 7.x/8.x 插件的安装和配置
2010-06-25 23:57 1682Myeclipse 7.x/8.x 插件的安装和配置 ... -
Proxool 连接池监控页面中文乱码异常的处理
2010-06-22 12:50 3987这几天, 在使用proxool监控连接池状态的时候, 偶然发现 ... -
小图片大尺寸预览实现代码
2010-06-11 18:35 2298<!DOCTYPE HTML PUBLIC " ... -
CSS 控制背景图片自动适应宽度和高度
2010-06-10 15:28 5308<!DOCTYPE html PUBLIC " ...
相关推荐
Using WebSphere Application Server Community Edition》是一本专注于Java企业版(Java EE)开发和WebSphere应用服务器社区版使用的专业指南。这本书深入浅出地介绍了如何利用IBM的开源应用服务器平台来构建高效、...
Using WebSphere Application Server V6.1 本标题明确指出本书的主要内容是关于使用IBM WebSphere Application Server 6.1版本进行J2EE(Java 2 Enterprise Edition)开发的经验分享和技术指导。 #### 描述:IBM...
### WebSphere Application Server 6.0 应用指南 #### WebSphere Application Server 6.0 开发工具介绍 **WebSphere Application Server (WAS) 6.0** 的发布标志着IBM在企业级Java应用服务器领域的新里程碑。此...
### WebSphere Application Server V6.1安全手册知识点详解 #### 一、概述 《WebSphere Application Server V6.1 Security Handbook》是IBM公司为WebSphere Application Server V6.1版本编写的安全指南。该文档...
根据提供的文档信息,我们可以推断出这是一份关于 IBM WebSphere Application Server V5 管理的培训材料。下面将详细介绍这份文档中的关键知识点。 ### 一、文档概述 此文档名为《W38S1 Administration of ...
WebSphere Application Server for Developers V8.5.5是供开发人员使用的免费版的was,需要的小伙伴可以本地安装一下 ,部署测试web项目,因为上传空间有限,这里就只上传windows64位的。
### WebSphere Application Server V6 自动安装应用程序知识点详解 #### 一、概述 **WebSphere Application Server (WAS) V6** 是IBM提供的一款企业级应用服务器产品,它支持多种应用开发模型,如Java EE、Web ...
WebSphere Application Server 启动错误诊断 在本文中,我们将详细介绍 WebSphere Application Server(WAS)启动错误的诊断方法。WAS 是一个复杂的应用服务器,启动过程中可能会出现各种错误,影响服务器的正常...
WebSphere Application Server9.0.0.2 安装包百度云盘资源地址,非商业用途,仅供学习使用。
《WebSphere Application Server Administration Using Jython》是一本详细介绍如何使用Jython进行WebSphere应用服务器管理的参考资料。在CSDN等技术社区中,这方面的资料可能并不常见,因此这个样本代码集尤其珍贵...
### WebSphere Application Server for Developers V7 #### 一、概述 IBM WebSphere Application Server (WAS) 是一款高性能的企业级应用服务器,适用于构建、部署和管理企业级Java应用程序。本指南旨在帮助开发者...
WebSphere Application Server(WAS)是IBM提供的一款强大的企业级应用服务器,它是Java EE(Java Platform, Enterprise Edition)平台的实现,为企业级应用程序提供运行环境。在本文中,我们将深入探讨WebSphere ...
### WebSphere Application Server V6 系统管理与配置手册知识点概览 #### 一、WebSphere Application Server V6 概述 **1.1 WebSphere 概览** WebSphere 是 IBM 开发的一套全面的企业应用解决方案,旨在为开发、...
WebSphere Application Server集群和架构FAQ
### WebSphere Application Server SSL配置详解 #### 一、概述 在现代互联网环境下,为了保障数据的安全性和隐私性,采用SSL/TLS加密已经成为一种普遍做法。本文档将详细介绍如何配置IBM WebSphere Application ...
IBM WebSphere Application Server是一款强大的企业级Java应用程序服务器,主要用于托管基于Java EE(Java Enterprise Edition)的应用。这款服务器软件是IBM公司的旗舰产品之一,为大型企业和组织提供了可靠的平台...
通过IBM WebSphere Application Server for Developers, 安装 WebSphere Application Server for Developers v8.5 的全过程截图。