I'm trying to connect my database in Wildfly to jJva. Unfortunately I get an error sayign the connection and login failed. How do I solve this?
When I try to test my connection in wildfly management, I get error:
Unexpected HTTP response: 500
Request
{
"address" => [
("subsystem" => "datasources"),
("data-source" => "LaundryBookingApp")
],
"operation" => "test-connection-in-pool"
}
Response
Internal Server Error
{
"outcome" => "failed",
"failure-description" => "WFLYJCA0040: failed to invoke operation:
WFLYJCA0047: Connection is not valid",
"rolled-back" => true
}
When I look in the console in Java it gives me this long error:
WARN [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (External
Management Request Threads -- 1) IJ000604: Throwable while attempting to get
a new connection: null: javax.resource.ResourceException: IJ031084: Unable
to create connection
errors.....
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for
user 'username'. ClientConnectionId:1588df01-34e0-4590-9b3a-48b220671c84
errors.....
ERROR [org.jboss.as.controller.management-operation] (External Management
Request Threads -- 1) WFLYCTL0013: Operation ("test-connection-in-pool")
failed - address: ([
("subsystem" => "datasources"),
("data-source" => "LaundryBookingApp")
]) - failure description: "WFLYJCA0040: failed to invoke operation:
WFLYJCA0047: Connection is not valid"
Here's my standalone.xml:
<datasources>
<datasource jndi-name="java:jboss/datasources/jdbc/LaundryBookingApp" pool-
name="LaundryBookingApp" enabled="true" jta="true" use-ccm="false">
<connection-url>
jdbc:sqlserver://localhost:1433;databaseName=LaundryBookingApp;
</connection-url>
<driver>sqljdbc4</driver>
<security>
<user-name>username</user-name>
<password>password</password>
</security>
<validation>
<validate-on-match>false</validate-on-match>
<background-validation>false</background-validation>
<background-validation-millis>1</background-validation-millis>
</validation>
<statement>
<prepared-statement-cache-size>0</prepared-statement-cache-size>
<share-prepared-statements>false</share-prepared-statements>
</statement>
</datasource>
<drivers>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
<driver name="sqljdbc4" module="com.microsoft.sqlserver.jdbc">
<xa-datasource-class>com.microsoft.sqlserver.jdbc.SQLServerXADataSource</xa-
datasource-class>
</driver>
</drivers>
</datasources>
</subsystem>