简体   繁体   English

WildFly 13数据源getConnection(用户,密码)不起作用

[英]WildFly 13 datasource getConnection(user, password) doesn't work

Using WildFly 13. I'm trying to get a java.sql.Connection from the datasource that is being defined in stadalone.xml, as so: 使用WildFly13。我试图从在stadalone.xml中定义的数据源获取java.sql.Connection,如下所示:

ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup("java:jboss/datasources/myDS");
connection = ds.getConnection(user, password);

The above always fails with Caused by: javax.resource.ResourceException: IJ031016: Wrong credentials passed to getConnection , while 上面的内容始终因以下原因而失败Caused by: javax.resource.ResourceException: IJ031016: Wrong credentials passed to getConnection ,而

ds.getConnection()

works just fine and can retrieve the connection. 工作正常,可以检索连接。 Moreover, when getting and inspecting the metadata from the connection retrieved via the no args call, the user and password seem to be the same that I'm passing to the method with arguments but which fails. 此外,在通过no args调用检索的连接中获取和检查元数据时,用户名和密码似乎与我传递给带有参数的方法相同,但失败了。

数据源的pool部分必须包含true属性,此属性才能起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM