After upgrading to 12.3, I can no longer connect to an MS SQL Server using OpenSQLConnection. Apparently due to some problem with Java(?). I tried to reinstall JRE 8, but no change.

DatabaseExplorer[] gives "Error: JDBC::error" on the connect page.

Any idea how to approach this, what to try?

Output from failed OpenSQLConnection

  • $\begingroup$ Is this a JDBC driver you set up yourself or one that came packaged with MMA? I don't know the details exactly, but I think it's possible that DatabaseLink has it's own JRE packaged with MMA, so the JRE you have installed may not be picked up. $\endgroup$ Aug 19, 2021 at 15:53
  • $\begingroup$ I am using similar code on version 12.1. I'll upgrade one of my machines to 12.3 and see if it still works. $\endgroup$ Aug 20, 2021 at 19:49
  • $\begingroup$ I updated to 12.3 and now my SQL code does not work on that computer. I even tried the suggestion from mathematica.stackexchange.com/questions/41431/… but it didn't help. $\endgroup$ Aug 20, 2021 at 20:09
  • $\begingroup$ @SjoerdSmit It’s the included driver. When my code didn’t work, I tried installing JRE 8, with no change in result. Could the driver be faulty, cf Rudy Potter”s experience? $\endgroup$
    – HJensen
    Aug 22, 2021 at 7:05
  • $\begingroup$ I just tried to revert to MMA 12.2 and here I have no problem with my code above! Any suggestions where to look for differences? $\endgroup$
    – HJensen
    Aug 22, 2021 at 13:37

1 Answer 1


I received the following from Wolfram and it worked for me:

As a workaround, please try the following:

  1. Download Microsoft mssql jdbc driver zip fie from https://docs.microsoft.com/en-us/sql/connect/jdbc/download-microsoft-jdbc-driver-for-sql-server?view=sql-server-ver15#download
  2. Unzip the driver
  3. Copy mssql-jdbc-9.4.0.jre11.jar to FileNameJoin[{$InstallationDirectory, "SystemFiles", "Links", "DatabaseLink", "Java"}]

Then connect to mssql database as follows:

In[1]:= Needs["DatabaseLink`"]
In[2]:= con4 = OpenSQLConnection[ JDBC["com.microsoft.sqlserver.jdbc.SQLServerDriver", "jdbc:sqlserver://" <> "host" ], "Catalog" ->"dbname", "Username" ->"username", "Password" ->"password" ]
  • $\begingroup$ Forgot to mark this as "solved", i.e. the workaround worked. The basic issue was resolved in version 13. $\endgroup$
    – HJensen
    Mar 6, 2022 at 19:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.