Edit the pom.xml file in the root of your project, there add the next dependency inside the <dependencies> part:
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>12.6.1.jre8</version>
</dependency>
Maybe the above code is already in your pom.xml but commented, in that case just uncomment it.<Resource name="jdbc/MyAppDS" auth="Container"
type="javax.sql.DataSource"
maxTotal="100" maxIdle="20" maxWaitMillis="10000"
username="root" password="ao49fmsk"
driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
url="jdbc:sqlserver://localhost:1433;databaseName=myappdb"/>
CREATE DATABASE myappdb;
$ cd myapp
$ mvn install
Optimization note: Instead of a mvn install, that do a complete Maven build, you can use mvn war:exploded, enough to apply the above changes for development. You can run mvn war:exploded from OpenXava Studio with Run As > Maven build... and typing war:exploded for goal.
Run your application, it should work nicely against your MS SQL Server database. If it fails, verify that your database server is up, that the user and password in context.xml are correct, that the server IP is correct. Also verify that the user has rights to create databases and tables (if you want to use the automatic schema generation of OpenXava, not needed if the tables already exist).
If the application doesn't work and at some point in the error trace you encounter this:
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption.
Error: "PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target". ClientConnectionId:6b818518-97bd-4b0d-adb2-153605134e2e
To resolve the problem, add the suffix ;encrypt=true;trustServerCertificate=true; to the connection URL, leaving your data source definition in context.xml as follows::
<Resource name="jdbc/MyAppDS" auth="Container"
type="javax.sql.DataSource"
maxTotal="100" maxIdle="20" maxWaitMillis="10000"
username="root" password="ao49fmsk"
driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
url="jdbc:sqlserver://localhost:1433;databaseName=myappdb;encrypt=true;trustServerCertificate=true;"/>
If it still fails ask us in the OpenXava Help forum. Include the content of your persistence.xml, context.xml (remove the passwords) and specially the stacktrace produced, you can find the trace in the Console tab of OpenXava Studio.