Java - Connect to remote SQL Server using DriverManager class on Maven project
https://docs.microsoft.com/en-us/sql/connect/jdbc/working-with-a-connection?view=sql-server-ver15
Create connection
Use Class.forName
to prevent No suitable driver found for jdbc:sqlite error:
eg,
Connect and return the connection
Issue: java.lang.UnsupportedClassVersionError: com/microsoft/sqlserver/jdbc/SQLServerDriver has been compiled by a more recent version of the Java Runtime
Solution
https://community.atlassian.com/t5/Jira-questions/Error-SQLServerDriver-has-been-compiled-by-a-more-recent-version/qaq-p/1112129
Instead of using the latest version, use older version of mssql-jdbc Maven dependency
Create connection and query data