Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adaptive Server connection timed out #94

Open
benedikt-mue opened this issue Oct 27, 2021 · 5 comments
Open

Adaptive Server connection timed out #94

benedikt-mue opened this issue Oct 27, 2021 · 5 comments

Comments

@benedikt-mue
Copy link

benedikt-mue commented Oct 27, 2021

I am encountering a rather odd behavior when trying to execute an UPDATE stmt:

connection = ctds.connect(DATABASE_HOST, user=DATABASE_USER, password=DATABASE_PASSWD,
 database=DATABASE_NAME)

with connection as conn:
        conn.cursor().execute("""
            --SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
                UPDATE [dbo].[test] 
                SET
                    col1 = s.col1,
                    col2 = s.col2,
                    col3 = s.col3,
                    col4 = s.col4
            FROM dbo.source s
                WHERE [dbo].[test].row_key = s.row_key
            ;
        """)

Results in:
DatabaseError: Adaptive Server connection timed out

However, executing the exact same stmt in DataStudio, it does work as intended.

Versions:
ctds version: 1.14.0
FreeTDS version: freetds v1.2.10

@burkol
Copy link

burkol commented Aug 22, 2022

Hi

I faced this issue on Ubuntu 20.04.3 LTS.
After the following env settings the problem is solved:
export TDSVER=8.0
export LANG=en_US.UTF-8

@josephraj2k16
Copy link

Hi

I faced this issue on Ubuntu 20.04.3 LTS. After the following env settings the problem is solved: export TDSVER=8.0 export LANG=en_US.UTF-8

Where to include this env settings? I'am using Linux in my end

@tf-njk
Copy link

tf-njk commented Nov 10, 2022

Hi

I am facing this same issue with ctds.connect(), where can I put @burkol's settings to fix this? or what is the best way to fix this?

@benedikt-mue @almonteb @kadrach @robatron

@burkol
Copy link

burkol commented Nov 10, 2022

Hi All,

I've a script with 3 lines:

. ~/envs/dataloader_batch_env/bin/activate
. ~/batches/env.sh
python3 ~/batches/dataloader.py

The env.sh contains the mentioned settings:

export TDSVER=7.3
export LANG=en_US.UTF-8

Note: Changed the 8.0 to 7.3 because of date conversion issue.
This line wasn't work with 8.0 ctds.SqlVarChar('2011-01-01'.encode('utf-16le'))

In the dataloader.py the connection looks like:

from ctds import connect as SqlConnect
connection_setting = {
	'server': "<server_name>.database.windows.net", 
	'database': "<database_name>", 
	'user': "<user_name>@<server_name>", 
	'password': "<password>"
}

with SqlConnect(**connection_setting) as connection:

I hope I could help

@HuangRicky
Copy link

HuangRicky commented Nov 10, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants