我试图创建一个连接到 Oracle AD 队列的 MDB (JBoss AS 6)。
我得到了以下示例:
@MessageDriven(name = "TestMdb", activationConfig = {
@ActivationConfigProperty(propertyName="destinationType", propertyValue = "javax.jms.Queue"),
@ActivationConfigProperty(propertyName="connectionFactoryProperties", propertyValue="jdbc_connect_string=jdbc:oracle:thin:XXXXX@XXX:1521:XXX,host=XXXX,user=XXXX,password=XXXX,port=XXXX,sid=XXXX,driver=XXXX"),
@ActivationConfigProperty(propertyName="destinationProperties", propertyValue="owner=XXXXX,name=jms_text_que"),
@ActivationConfigProperty(propertyName="userName", propertyValue="XXXX"),
@ActivationConfigProperty(propertyName="password", propertyValue="XXXX"),
@ActivationConfigProperty(propertyName="ConnectionFactoryClassName", propertyValue="oracle.jms.AQjmsConnectionFactory"),
@ActivationConfigProperty(propertyName="QueueConnectionFactoryClassName", propertyValue="oracle.jms.AQjmsQueueConnectionFactory")
})
@ResourceAdapter("XXXXXX-ear.ear#genericjmsra.rar")
@TransactionManagement(TransactionManagementType.BEAN)
public class TestMdb implements MessageListener {
public void onMessage(Message message) {
...
}
}
问题是我需要直接在代码中指定连接属性(包括数据库主机、用户名和密码)。有谁知道从 jndi 查找中使用数据源的方法?
谢谢