connector-x icon indicating copy to clipboard operation
connector-x copied to clipboard

Is there a way to debug the connection?

Open RMHogervorst opened this issue 2 years ago • 4 comments

I've tried connecting to a mssql server like this:

import os
os.environ['RUST_LOG']="connectorx=debug,connectorx_python=debug"
import connectorx as cx

url = "mssql://user_name:password@server_host:port/db_name"
df = cx.read_sql(url, "select top 10 * from dbo.stupidtablename")

But all I get back is:

[datetime DEBUG connectorx_python::pandas] Running dispatcher
[datetime DEBUG connectorx::dispatcher] Fetching metadata
Traceback to connectorx/__init__py
RuntimeError: Timed out in bb8

Is there a way for me to debug connection info? It must not reach the server or something like that

RMHogervorst avatar Dec 09 '21 12:12 RMHogervorst

Hi @RMHogervorst , thanks for the log! Indeed it looks like it cannot connect to mssql. Maybe one thing you can do is to use another client tool to make sure the host and port are correct. What I usually use is mssql-cli. It is easy to install (pip install mssql-cli) and you can try out your connection info using command: mssql-cli -S"${server_host},${port}" -U${user} -P${password} -d${db_name}.

wangxiaoying avatar Dec 09 '21 17:12 wangxiaoying

Hi @wangxiaoying 👍 thank you for the advice. I dont have issues talking to dB via my laptop (either via pyodbc / mssql-cli). I think it's could be some cloud related/ network issue. My code is running as web app service and its quering some data from SQL sitting in a VM. Any advice / comments would help.

sundeeprpatil avatar Jan 10 '22 09:01 sundeeprpatil

Hi @sundeeprpatil , I'm not sure what's the error message you got. But if it's the same timed out, then I think it is because the database is not reachable from the code's running environment. Instead of running on your laptop, you need to run mssql-cli inside the same VM to see whether it works.

wangxiaoying avatar Jan 11 '22 01:01 wangxiaoying

Yes: I used IP instead of the right end point, which works locally but does not work in public cloud. Check hybrid connection module for the right connection string.

On Wed, May 4, 2022 at 4:35 PM stefVleugels7 @.***> wrote:

Hi @sundeeprpatil https://github.com/sundeeprpatil , I'm experiencing the same issue with an Azure SQL server. Have you found a solution for this?

— Reply to this email directly, view it on GitHub https://github.com/sfu-db/connector-x/issues/192#issuecomment-1117057974, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWL2B2R2RFKVPVAXHB3NNVTVIIZF7ANCNFSM5JWKH45A . You are receiving this because you were mentioned.Message ID: @.***>

sundeeprpatil avatar May 04 '22 09:05 sundeeprpatil