1、JDBC提供者
WAS內置了MS SQL SERVER的驅動,所以JDBC的提供者你可以選擇WAS內置的JDBC驅動.
配置參數如下:
提供者名稱:
MS SQL SERVER(XA) (可以自己隨便取)
類別路徑:
${WAS_LIBS_DIR}/sqlserver.jar
${WAS_LIBS_DIR}/base.jar
${WAS_LIBS_DIR}/util.jar
${WAS_LIBS_DIR}/spy.jar
實作類別名稱:
com.ibm.websphere.jdbcx.sqlserver.SQLServerDataSource
2、數據源的配置方法與其它DB的數據源配置方法無異。
可參考:
http://www.blogjava.net/fastzch/archive/2006/12/03/85176.html3、關鍵部分,配置你的SQL SERVER DB,使其支持XA方式。
(1)到下面這個地址下載SQL SERVER支援XA的驅動:      
ftp://ftp.software.ibm.com/software/websphere/info/tools/DataDirect/datadirect.htm      也可以到MS的官方網站下載對應的驅動。
(2)下載後會有一個RAR包,將其解壓,根據你的OS是32位還是64位來決定你要選用哪個sqljdbc.dll
      將此文件放入SQL SERVER安裝目錄的BINN目錄下。
(3)重啟SQL SERVER DB。
(4)在Master資料庫上運行RAR包中的instjdbc.sql這個SQL          


 /**//*
/**//*
 **    INSTJDBC.SQL
**    INSTJDBC.SQL
 **    Installs XA stored procedures used by the JDBC driver
**    Installs XA stored procedures used by the JDBC driver 
 */
*/


 go
go
 use master
use master
 go
go
 dump tran master with no_log
dump tran master with no_log
 go
go



 /**//*
/**//*
 ** drop procedures if they're already in the database
** drop procedures if they're already in the database
 */
*/

 sp_dropextendedproc 'xp_jdbc_open'
sp_dropextendedproc 'xp_jdbc_open' 
 go
go
 sp_dropextendedproc 'xp_jdbc_open2'
sp_dropextendedproc 'xp_jdbc_open2' 
 go
go
 sp_dropextendedproc 'xp_jdbc_close'
sp_dropextendedproc 'xp_jdbc_close'
 go
go
 sp_dropextendedproc 'xp_jdbc_close2'
sp_dropextendedproc 'xp_jdbc_close2'
 go
go
 sp_dropextendedproc 'xp_jdbc_start'
sp_dropextendedproc 'xp_jdbc_start'
 go
go
 sp_dropextendedproc 'xp_jdbc_start2'
sp_dropextendedproc 'xp_jdbc_start2'
 go
go
 sp_dropextendedproc 'xp_jdbc_end'
sp_dropextendedproc 'xp_jdbc_end'
 go
go
 sp_dropextendedproc 'xp_jdbc_end2'
sp_dropextendedproc 'xp_jdbc_end2'
 go
go
 sp_dropextendedproc 'xp_jdbc_prepare'
sp_dropextendedproc 'xp_jdbc_prepare'
 go
go
 sp_dropextendedproc 'xp_jdbc_prepare2'
sp_dropextendedproc 'xp_jdbc_prepare2'
 go
go
 sp_dropextendedproc 'xp_jdbc_commit'
sp_dropextendedproc 'xp_jdbc_commit'
 go
go
 sp_dropextendedproc 'xp_jdbc_commit2'
sp_dropextendedproc 'xp_jdbc_commit2'
 go
go
 sp_dropextendedproc 'xp_jdbc_rollback'
sp_dropextendedproc 'xp_jdbc_rollback'
 go
go
 sp_dropextendedproc 'xp_jdbc_rollback2'
sp_dropextendedproc 'xp_jdbc_rollback2'
 go
go
 sp_dropextendedproc 'xp_jdbc_forget'
sp_dropextendedproc 'xp_jdbc_forget'
 go
go
 sp_dropextendedproc 'xp_jdbc_forget2'
sp_dropextendedproc 'xp_jdbc_forget2'
 go
go
 sp_dropextendedproc 'xp_jdbc_recover'
sp_dropextendedproc 'xp_jdbc_recover'
 go
go
 sp_dropextendedproc 'xp_jdbc_recover2'
sp_dropextendedproc 'xp_jdbc_recover2'
 go
go
 dump tran master with no_log
dump tran master with no_log
 go
go




 /**//*
/**//*
 **  add references for the stored procedures
**  add references for the stored procedures
 */
*/

 print 'creating JDBC XA procedures'
print 'creating JDBC XA procedures'
 go
go

 sp_addextendedproc 'xp_jdbc_open', 'sqljdbc.dll'
sp_addextendedproc 'xp_jdbc_open', 'sqljdbc.dll'
 go
go
 sp_addextendedproc 'xp_jdbc_open2', 'sqljdbc.dll'
sp_addextendedproc 'xp_jdbc_open2', 'sqljdbc.dll'
 go
go
 sp_addextendedproc 'xp_jdbc_close', 'sqljdbc.dll'
sp_addextendedproc 'xp_jdbc_close', 'sqljdbc.dll'
 go
go
 sp_addextendedproc 'xp_jdbc_close2', 'sqljdbc.dll'
sp_addextendedproc 'xp_jdbc_close2', 'sqljdbc.dll'
 go
go
 sp_addextendedproc 'xp_jdbc_start', 'sqljdbc.dll'
sp_addextendedproc 'xp_jdbc_start', 'sqljdbc.dll'
 go
go
 sp_addextendedproc 'xp_jdbc_start2', 'sqljdbc.dll'
sp_addextendedproc 'xp_jdbc_start2', 'sqljdbc.dll'
 go
go
 sp_addextendedproc 'xp_jdbc_end', 'sqljdbc.dll'
sp_addextendedproc 'xp_jdbc_end', 'sqljdbc.dll'
 go
go
 sp_addextendedproc 'xp_jdbc_end2', 'sqljdbc.dll'
sp_addextendedproc 'xp_jdbc_end2', 'sqljdbc.dll'
 go
go
 sp_addextendedproc 'xp_jdbc_prepare', 'sqljdbc.dll'
sp_addextendedproc 'xp_jdbc_prepare', 'sqljdbc.dll'
 go
go
 sp_addextendedproc 'xp_jdbc_prepare2', 'sqljdbc.dll'
sp_addextendedproc 'xp_jdbc_prepare2', 'sqljdbc.dll'
 go
go
 sp_addextendedproc 'xp_jdbc_commit', 'sqljdbc.dll'
sp_addextendedproc 'xp_jdbc_commit', 'sqljdbc.dll'
 go
go
 sp_addextendedproc 'xp_jdbc_commit2', 'sqljdbc.dll'
sp_addextendedproc 'xp_jdbc_commit2', 'sqljdbc.dll'
 go
go
 sp_addextendedproc 'xp_jdbc_rollback', 'sqljdbc.dll'
sp_addextendedproc 'xp_jdbc_rollback', 'sqljdbc.dll'
 go
go
 sp_addextendedproc 'xp_jdbc_rollback2', 'sqljdbc.dll'
sp_addextendedproc 'xp_jdbc_rollback2', 'sqljdbc.dll'
 go
go
 sp_addextendedproc 'xp_jdbc_forget', 'sqljdbc.dll'
sp_addextendedproc 'xp_jdbc_forget', 'sqljdbc.dll'
 go
go
 sp_addextendedproc 'xp_jdbc_forget2', 'sqljdbc.dll'
sp_addextendedproc 'xp_jdbc_forget2', 'sqljdbc.dll'
 go
go
 sp_addextendedproc 'xp_jdbc_recover', 'sqljdbc.dll'
sp_addextendedproc 'xp_jdbc_recover', 'sqljdbc.dll'
 go
go
 sp_addextendedproc 'xp_jdbc_recover2', 'sqljdbc.dll'
sp_addextendedproc 'xp_jdbc_recover2', 'sqljdbc.dll'
 go
go



 /**//*
/**//*
 **  grant privileges so that all users can enlist in XA transactions
**  grant privileges so that all users can enlist in XA transactions
 */
*/
 grant execute on xp_jdbc_open to public
grant execute on xp_jdbc_open to public
 go
go
 grant execute on xp_jdbc_open2 to public
grant execute on xp_jdbc_open2 to public
 go
go
 grant execute on xp_jdbc_close to public
grant execute on xp_jdbc_close to public
 go
go
 grant execute on xp_jdbc_close2 to public
grant execute on xp_jdbc_close2 to public
 go
go
 grant execute on xp_jdbc_start to public
grant execute on xp_jdbc_start to public
 go
go
 grant execute on xp_jdbc_start2 to public
grant execute on xp_jdbc_start2 to public
 go
go
 grant execute on xp_jdbc_end to public
grant execute on xp_jdbc_end to public
 go
go
 grant execute on xp_jdbc_end2 to public
grant execute on xp_jdbc_end2 to public
 go
go
 grant execute on xp_jdbc_prepare to public
grant execute on xp_jdbc_prepare to public
 go
go
 grant execute on xp_jdbc_prepare2 to public
grant execute on xp_jdbc_prepare2 to public
 go
go
 grant execute on xp_jdbc_commit to public
grant execute on xp_jdbc_commit to public
 go
go
 grant execute on xp_jdbc_commit2 to public
grant execute on xp_jdbc_commit2 to public
 go
go
 grant execute on xp_jdbc_rollback to public
grant execute on xp_jdbc_rollback to public
 go
go
 grant execute on xp_jdbc_rollback2 to public
grant execute on xp_jdbc_rollback2 to public
 go
go
 grant execute on xp_jdbc_forget to public
grant execute on xp_jdbc_forget to public
 go
go
 grant execute on xp_jdbc_forget2 to public
grant execute on xp_jdbc_forget2 to public
 go
go
 grant execute on xp_jdbc_recover to public
grant execute on xp_jdbc_recover to public
 go
go
 grant execute on xp_jdbc_recover2 to public
grant execute on xp_jdbc_recover2 to public
 go
go

 print ''
print ''
 print 'instxa.sql completed successfully.'
print 'instxa.sql completed successfully.'
 go
go

 dump tran master with no_log
dump tran master with no_log
 go
go
 checkpoint
checkpoint
 go
go

 /** *//**/
/** *//**/

4、在控制面板的服務中,啟動“Distributed Transaction Coordinator”服務。
      此服務的作用如下:協調跨越多個資源管理員的交易,比如資料庫、訊息佇列及檔案系統。如果此服務被停止,這些交易將不會發生。如果服務被停用,任何明顯依存它的服務將無法啟動。
5、測試數據源:
完成!
	
posted on 2007-07-10 20:43 
Robin's Programming World 阅读(3198) 
评论(1)  编辑  收藏  所属分类: 
Java 、
Webshere 、
DB