Clear Filters
Clear Filters

Database function error message

5 views (last 30 days)
Max Trivedi
Max Trivedi on 7 Jul 2022
Answered: Dinesh on 17 Nov 2023
Attempting to connect to microsoft analysis service sql server to pull data from a tabular model using jdb4olap driver, when running the database command with required inputs connection always fails with the following error message in red text:
WARNING: ConnectionID:7 ClientConnectionId: 44c0cefa-45cf-4456-8aaa-1fc4e4a54aac Prelogin error: host [servername] port 55989 Error reading prelogin response: Connection reset ClientConnectionId:44c0cefa-45cf-4456-8aaa-1fc4e4a54aac
Jul 05, 2022 3:29:37 PM com.microsoft.sqlserver.jdbc.SQLServerConnection Prelogin
Using the JDBC Data Source Configuration panel in database toolbox gives the same error when testing the connection.
I am struggling to debug this to find out what the problem is. Any help would be appreciated.

Answers (1)

Dinesh
Dinesh on 17 Nov 2023
Hi Max.
The error that you are facing is most likely because you are using "MySQL" as DB and trying to connect to "SQLSERVER DB" in your code.
Here's a sample code to connect to a MySQL database:
conn = database('your_database', 'your_username', 'your_password', 'com.mysql.cj.jdbc.Driver', 'jdbc:mysql://hostname:port/your_database');

Products


Release

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!