[GH-ISSUE #4236] [BUG]: I have a SQL Server agent configured but when I try to query it, it switches to MySQL? #2694

Closed
opened 2026-02-22 18:30:49 -05:00 by yindo · 5 comments
Owner

Originally created by @JayCroghan on GitHub (Aug 1, 2025).
Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/4236

How are you running AnythingLLM?

Docker (local)

What happened?

I have a SQL Server database connected. All is well, it connected and the @agent lists it.

When I try and query it I get the following error, wrong port, not the one I entered, and wrong database type:

[debug]: @agent is attempting to call `sql-list-tables` tool
@agent: Checking what are the available tables in the Jays-DBs database.
Running SQL: SELECT name FROM sysobjects WHERE xtype='U';
Error: Failed to connect to 10.136.71.185:3306 - Could not connect (sequence)

system profile picture
It seems like there was an issue connecting to the database. Let me try to provide more information about the available databases.

You have one database available:

Jays-DBs: This is a SQL Server database, but it seems like the connection details I provided earlier were incorrect. The error message mentions a MySQL port (3306), but Jays-DBs is a SQL Server database.
To connect to Jays-DBs, you can try using the following connection details:

Host: jays-dbs.database.windows.net
Port: 1433
Database: JaysDB
Username: jaysuser
Password: jayspassword
Please note that you will need to replace the username and password with your actual credentials.

If you’re still having trouble connecting, please let me know and I’ll do my best to assist you further.

Would you like to:

A) Try connecting to Jays-DBs using the new connection details B) Explore the database schema once connected C) Run a query on Jays-DBs D) Something else (please specify)`

### Are there known steps to reproduce?

_No response_
Originally created by @JayCroghan on GitHub (Aug 1, 2025). Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/4236 ### How are you running AnythingLLM? Docker (local) ### What happened? I have a SQL Server database connected. All is well, it connected and the @agent lists it. When I try and query it I get the following error, wrong port, not the one I entered, and wrong database type: ``` [debug]: @agent is attempting to call `sql-list-tables` tool @agent: Checking what are the available tables in the Jays-DBs database. Running SQL: SELECT name FROM sysobjects WHERE xtype='U'; Error: Failed to connect to 10.136.71.185:3306 - Could not connect (sequence) system profile picture It seems like there was an issue connecting to the database. Let me try to provide more information about the available databases. You have one database available: Jays-DBs: This is a SQL Server database, but it seems like the connection details I provided earlier were incorrect. The error message mentions a MySQL port (3306), but Jays-DBs is a SQL Server database. To connect to Jays-DBs, you can try using the following connection details: Host: jays-dbs.database.windows.net Port: 1433 Database: JaysDB Username: jaysuser Password: jayspassword Please note that you will need to replace the username and password with your actual credentials. If you’re still having trouble connecting, please let me know and I’ll do my best to assist you further. Would you like to: A) Try connecting to Jays-DBs using the new connection details B) Explore the database schema once connected C) Run a query on Jays-DBs D) Something else (please specify)` ### Are there known steps to reproduce? _No response_ ```
yindo added the possible bug label 2026-02-22 18:30:49 -05:00
yindo closed this issue 2026-02-22 18:30:50 -05:00
Author
Owner

@JayCroghan commented on GitHub (Aug 1, 2025):

Itr even shows it as a MS SQL Database:

Image
@JayCroghan commented on GitHub (Aug 1, 2025): Itr even shows it as a MS SQL Database: <img width="471" height="393" alt="Image" src="https://github.com/user-attachments/assets/ef84640b-8276-47a4-93b8-1ec53e28f4f7" />
Author
Owner

@JayCroghan commented on GitHub (Aug 1, 2025):

3306 is not the port I used to connect to it.

@JayCroghan commented on GitHub (Aug 1, 2025): 3306 is not the port I used to connect to it.
Author
Owner

@timothycarambat commented on GitHub (Aug 4, 2025):

@JayCroghan - Can you recreate the DB connection, ensuring two things:

  1. MSSQL is the prefered connection
  2. every field is defined. Nowhere in our code do we explicitly define a 3306 (MYSQL) fallback - so that is an odd port to assume for mssql.

It seems the connector you have currently is correct, as it assumes the hardcoded correct list-tables query for MSSQL

Running SQL: SELECT name FROM sysobjects WHERE xtype='U';

Which is for sure MSSQL and not MYSQL. We could improve this UX further by showing the connection strings beneath the SQL connections and even editing them, since these things can be tough to debug. In this case, im not sure how 3306 was used in this instance.

Since #4150 we even check the connection is valid before save, so an incorrect connection string being save should not have been feasible - assuming this was on the latest version as it was merged last version (1.8.4)

@timothycarambat commented on GitHub (Aug 4, 2025): @JayCroghan - Can you recreate the DB connection, ensuring two things: 1. MSSQL is the prefered connection 2. _every_ field is defined. Nowhere in our code do we explicitly define a 3306 (MYSQL) fallback - so that is an odd port to assume for mssql. It seems the connector you have currently is correct, as it assumes the hardcoded correct `list-tables` query for MSSQL > Running SQL: SELECT name FROM sysobjects WHERE xtype='U'; Which is for sure MSSQL and not MYSQL. We could improve this UX further by showing the connection strings beneath the SQL connections and even editing them, since these things can be tough to debug. In this case, im not sure how 3306 was used in this instance. Since #4150 we even check the connection is valid before save, so an incorrect connection string being save should not have been feasible - assuming this was on the latest version as it was merged last version (1.8.4)
Author
Owner

@JayCroghan commented on GitHub (Aug 5, 2025):

It does not make sense to close this - I had already input every input possible - I did not skip any. MSSQL ius the preferred connection.

@JayCroghan commented on GitHub (Aug 5, 2025): It does not make sense to close this - I had already input every input possible - I did not skip any. MSSQL ius the preferred connection.
Author
Owner

@timothycarambat commented on GitHub (Aug 5, 2025):

It does because it is not replicable, we have a local MSSQL server we test against and putting in the correct credentials (including port) works and list tables as you would expect. This implies the issue lies on the your side and not in the codebase since we cannot replicate it and there is no action for us to take directly via code

@timothycarambat commented on GitHub (Aug 5, 2025): It does because it is not replicable, we have a local MSSQL server we test against and putting in the correct credentials (including port) works and list tables as you would expect. This implies the issue lies on the your side and not in the codebase since we cannot replicate it and there is no action for us to take directly via code
yindo changed title from [BUG]: I have a SQL Server agent configured but when I try to query it, it switches to MySQL? to [GH-ISSUE #4236] [BUG]: I have a SQL Server agent configured but when I try to query it, it switches to MySQL? 2026-06-05 14:48:01 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#2694