JBoss 3.0如何连接Oracle数据库?

wenliang_d 2002-06-14 04:15:16
加精
JBoss 3.0连接数据库得方式和JBOss2.4.3得方式有很多不同,捣腾了半天也没有连上。请大侠出手相救!
...全文
46 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
wenliang_d 2002-06-17
  • 打赏
  • 举报
回复
感谢sharetop(天生不笨)!
另有一事不明:~/server/default/conf下standardjbosscmp-jdbc.xml何用?
这是俺在自己的环境下配置成功的步骤,供大家参考:
同Jboss 2.4.x不同,需要在~/server/default/deploy 目录下添加文件oracle-service.xml,这个文件可参看~/docs/examples/jca/目录下(该目录存有多种数据库配置文件模板)oracle-service.xml文件。
具体步骤如下:
1、 删除~/server/default/deploy下文件hsqldb-service.xml
2、 复制一份oracle-service.xml文件到~/server/default/deploy下
3、 修改该文件:
a) <!--comment out this line if you want component managed security or want
to use the default values in the ManagedConnectionFactoryProperties -->
<attribute name="SecurityDomainJndiName">OracleDbRealm</attribute>
改为:
<!--comment out this line if you want component managed security or want
to use the default values in the ManagedConnectionFactoryProperties
<attribute name="SecurityDomainJndiName">OracleDbRealm</attribute>
-->
b) 配置ConnectionURL:jjdbc:oracle:thin:@192.168.16.68:1521:ORA816
c) 配置下面的用户名和口令
4、 修改~/server/default/conf/standardjaws.xml文件(只是头几行)
<jaws>
<datasource>java:/DefaultDS</datasource>
<type-mapping>Hypersonic SQL</type-mapping>
<debug>false</debug>
改为:
<jaws>
<datasource>java:/OracleDS</datasource>
<type-mapping>Oracle8</type-mapping>
<debug>false</debug>
5、 将class12.jar添加到CLASSPATH当中。
wenliang_d 2002-06-17
  • 打赏
  • 举报
回复
我弄出来了,待会整理一下给贴出来!
superzrb 2002-06-16
  • 打赏
  • 举报
回复
gz
wenliang_d 2002-06-16
  • 打赏
  • 举报
回复
谢谢sharetop(天生不笨) 无私援助!

我现在启动,老是报告
15:22:47,639 ERROR [EjbModule] Initialization failed
org.jboss.deployment.DeploymentException: DefaultDS not bound
sharetop 2002-06-14
  • 打赏
  • 举报
回复
不好意思,上面给的方法不行,只是能够启来不报错,但我测试entitybean不行。

下面这个才可以的:

<?xml version="1.0" encoding="UTF-8"?>

<!-- ===================================================================== -->
<!-- -->
<!-- JBoss Server Configuration -->
<!-- -->
<!-- ===================================================================== -->

<!-- $Id: hsqldb-service.xml,v 1.2.2.4 2002/05/25 21:43:49 patriot1burke Exp $ -->


<server>

<!-- ==================================================================== -->
<!-- New ConnectionManager setup for default hsql dbs -->
<!-- Build jmx-api (build/build.sh all) and view for config documentation -->
<!-- ==================================================================== -->

<mbean code="org.jboss.resource.connectionmanager.LocalTxConnectionManager" name="jboss.jca:service=LocalTxCM,name=hsqldbDS">

<!-- Include a login module configuration named HsqlDbRealm.
Update your login-conf.xml, here is an example for a
ConfiguredIdentityLoginModule:

<application-policy name = "HsqlDbRealm">
<authentication>
<login-module code = "org.jboss.resource.security.ConfiguredIdentityLoginModule" flag = "required">
<module-option name = "principal">sa</module-option>
<module-option name = "userName">sa</module-option>
<module-option name = "password"></module-option>
<module-option name = "managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=hsqldbDS</module-option>
</login-module>
</authentication>
</application-policy>

NOTE: the application-policy name attribute must match
SecurityDomainJndiName, and the
module-option name = "managedConnectionFactoryName"
must match the object name of the ConnectionManager you are configuring here.
-->
<!--uncomment out this line if you are using the DB2DbRealm above
<attribute name="SecurityDomainJndiName">HsqlDbRealm</attribute>
-->

<depends optional-attribute-name="ManagedConnectionFactoryName">
<!--embedded mbean-->
<mbean code="org.jboss.resource.connectionmanager.RARDeployment" name="jboss.jca:service=LocalTxDS,name=mySQLDS">

<attribute name="JndiName">mySQLDS</attribute>
<attribute name="ManagedConnectionFactoryProperties">
<properties>
<config-property name="ConnectionURL" type="java.lang.String">jdbc:mysql://localhost/ads</config-property>
<config-property name="DriverClass" type="java.lang.String">org.gjt.mm.mysql.Driver</config-property>
<config-property name="UserName" type="java.lang.String">root</config-property>
<config-property name="Password" type="java.lang.String"></config-property>
</properties>
</attribute>

<depends optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name=JBoss LocalTransaction JDBC Wrapper</depends>

</mbean>
</depends>
<depends optional-attribute-name="ManagedConnectionPool">
<!--embedded mbean-->
<mbean code="org.jboss.resource.connectionmanager.JBossManagedConnectionPool" name="jboss.jca:service=LocalTxPool,name=mySQLDS">
<attribute name="MinSize">0</attribute>
<attribute name="MaxSize">50</attribute>
<attribute name="BlockingTimeoutMillis">5000</attribute>
<attribute name="IdleTimeoutMinutes">15</attribute>
<attribute name="Criteria">ByContainer</attribute>
</mbean>
</depends>
<depends optional-attribute-name="CachedConnectionManager">jboss.jca:service=CachedConnectionManager</depends>

<depends optional-attribute-name="JaasSecurityManagerService">jboss.security:name=JaasSecurityManager</depends>

<attribute name="TransactionManager">java:/TransactionManager</attribute>

<!--make the rar deploy! hack till better deployment-->
<depends>jboss.jca:service=RARDeployer</depends>

</mbean>

</server>
sharetop 2002-06-14
  • 打赏
  • 举报
回复
我知道了,

第一步:把以下存成mysql-service.xml文件,放在server/default/deploy目录下。

<?xml version="1.0" encoding="UTF-8"?>


<!-- ===================================================================== -->
<!-- -->
<!-- foo App DataSource -->
<!-- -->
<!-- ===================================================================== -->

<!-- $Id: resource.xml,v 1.5 2001/10/11 22:13:58 d_jencks Exp $ -->


<server>

<depends>JBOSS-SYSTEM:service=Naming</depends>
<depends>JBOSS-SYSTEM:service=TransactionManager</depends>
<depends>JCA:service=ConnectionManagerFactoryLoader,name=MinervaSharedLocalCMFactory</depends>
<depends>JCA:service=RARDeployer</depends>

<classpath codebase="lib" archives="mm.mysql-2.0.4-bin.jar"/>

<!-- ==================================================================== -->
<!-- JDBC - Initialize the databases -->
<!-- to ConnectionFactoryLoader -->
<!-- ==================================================================== -->

<mbean code="org.jboss.resource.ConnectionFactoryLoader"
name="DefaultDomain:service=ConnectionFactoryLoader,name=fooDS">
<attribute name="ManagedConnectionFactoryProperties">ConnectionURL=jdbc:mysql://localhost/arison_prp
DriverClass=org.gjt.mm.mysql.Driver
UserName=root</attribute>
<attribute name="JndiName">mySQLDS</attribute>
<attribute name="TransactionManagerName">java:/TransactionManager</attribute>
<attribute name="ResourceAdapterName">Minerva JDBC LocalTransaction ResourceAdapter</attribute>
<attribute name="RARDeployerName">JCA:service=RARDeployer</attribute>
<attribute name="ConnectionManagerFactoryName">MinervaSharedLocalCMFactory</attribute>
<attribute name="ConnectionManagerProperties">#
#Wed Aug 15 16:17:29 EDT 2001
InvalidateOnError=false
BlockingTimeoutMillis=500000
IdleTimeoutMillis=1800000
MaxSize=10
TimestampUsed=false
IdleTimeoutEnabled=false
CleanupIntervalMillis=120000
MinSize=0
GCMinIdleMillis=1200000
GCEnabled=false
MaxIdleTimeoutPercent=1.0
</attribute>
<attribute name="PrincipalMappingClass">
org.jboss.resource.security.ManyToOnePrincipalMapping
</attribute>
<attribute name="PrincipalMappingProperties">UserName=root</attribute>
</mbean>

</server>


第二步,把mm.mysql-2.0.4-bin.jar文件放在 server/default/lib目录下,也就是上面文件中指定的<classpath codebase="lib" ....

第三步,重启服务,正常发布。再试一下吧。

sharetop 2002-06-14
  • 打赏
  • 举报
回复
是啊,论坛好久没开了。

我看文档好象是用JCA来取代原来的jboss.jcml中的配置,这样,每种数据库都应该写一个mysql_service.xml或oracle_service.xml文件来描述它。

具体的方法我没有:)因为我现在不想换jboss3.0,还是用我以前的2.4.4吧,
wenliang_d 2002-06-14
  • 打赏
  • 举报
回复
工作上得事情,我暂时还没有决定权!
worldheart 2002-06-14
  • 打赏
  • 举报
回复
这个我知道,讨厌的JBOSS,不对,我还是蛮喜欢的!!

你为什么选择 JBOSS??难道就没替代的吗?
wenliang_d 2002-06-14
  • 打赏
  • 举报
回复
to worldheart(时讯技术):
网上一份JBoss 3_0 Documentation(Html和PDF版),里面讲的还是JBoss 2.4.3得内容。
不知何处可以得到最新得文档?
本来想到jboss.org得网站上看看,他们得系统升级,论坛不开,好些天了,真急死了!
worldheart 2002-06-14
  • 打赏
  • 举报
回复
参考JBoss 3.0文档!!!

62,615

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧