3 Replies Latest reply on Jul 3, 2018 3:02 AM by simkam

    Getting java.sql.Connection from WildFly 13 datasource when passing user and password as arguments

    sergiu_pienar

      Using WildFly 13.

      I'm trying to get a java.sql.Connection from the datasource that is being defined in stadalone.xml, as so:

      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 ds.getConnection() works just fine and can retrieve the connection.

       

      Moreover, when getting and inspecting the metadata from the connection, the user and password seem to be the same that I'm passing to the method with arguments but which fails.