Comments (6)
Hi dkleehammer,
First of all, thanks for an awesome project.
I'm having this problem with both 3.0.6 and the latest beta (3.0.7-beta03). If I set an incorrect server name in the connect string it tries to connect forever even though I've added the timeout flag to the connect method. Keyboard interrupts don't work until maybe a minute in or so.
I'm on Mac OS X 10.8.2 (64-bit) and the database I'm trying to connect to is a SQL Server 2008 R2 x64 (10.50.1617.0).
I can see that you closed this ticket. Was this fixed?
from pyodbc.
jmagnusson,
Actually, this project is ran by my brother, mkleehammer, but I'm sure he'll check this one. :D
I was incorrect about the keywords in the connection string. The timeout is soley used for query timeouts. We are investigating why the odbc connection timeout isn't being handled properly. We believe we are on the right track and will update pyodbc with the fix as quickly as possible.
dk
from pyodbc.
Did this ever get fixed?
Currently I have a firewall blocking outbound database connections. I've only just found this out after some debugging - unfortunately the timeout keyword seems to be being ignored and it hangs forever. On non firewalled host it works fine but I need me application to raise an error not just hang.
CONN_STRING = 'DSN={};DATABASE={};UID={};PWD={}'.format(SERVER,DATABASE,UID,PWD) conn = pyodbc.connect(CONN_STRING,timeout=15)
from pyodbc.
Is this issue fixed?
from pyodbc.
I don't believe so
On Wed, 6 Apr 2016, 09:13 Sreejith Kesavan, [email protected]
wrote:
Is this issue fixed?
—
You are receiving this because you commented.
Reply to this email directly or view it on GitHub
#11 (comment)
Sent from Android
from pyodbc.
Just discovered this same issue on Windows Server 2019 using ODBC Driver 17 for SQL Server
. I have a canary that is checking health of services using pyodbc
and hit was hanging on this when port is not responding.
Work around is to do a port scan of 1433 before trying to connect.
Here is a helper for scanning ports:
# (bPortOpen, iErrno) = scanPort('<ip>', <port>)
def scanPort(host:str, port:int, timeout:int=4) -> tuple(bool, int):
errno = 0 # see TCP socket error codes https://gist.github.com/gabrielfalcao/4216897
sock = None
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.settimeout(timeout)
errno = sock.connect_ex((host, port))
except socket.timeout:
errno=-1
except socket.gaierror:
errno=112
except socket.error:
errno=111
try:
sock.close()
except:
None
return ((errno == 0), errno)
from pyodbc.
Related Issues (20)
- Add support for SQLTablePrivileges
- Login Timeout Error when connecting to Synapse database using pyodbc python library in Azure synapse notebook via Managed Identity HOT 1
- reference count encoding in the connect function HOT 5
- PyToCType uses internal function removed from Python 3.13 HOT 3
- I am trying to install pyodbc in MacBook Pro M3 chip - arm64. The drivers are installed succesfully for odbc 13,17 and 18. But pyodbc is not able to detect the drivers.:
- I am trying to install pyodbc in MacBook Pro M3 chip - arm64. The drivers are installed succesfully for odbc 13,17 and 18. But pyodbc is not able to detect the drivers. ERROR: ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib 'ODBC Driver 17 for SQL Server' : file not found (0) (SQLDriverConnect)") HOT 5
- Executing multiple queries HOT 1
- pyodbc.connect() gives an error when executing it with pytest HOT 1
- InterfaceError: Data source name not found with pyodbc despite working with isql HOT 8
- Multiple threads querying same table takes a long time HOT 19
- Timeout not being enforced in SQL query HOT 7
- How to use Federated credentials with service principal to auth the Azure resources HOT 7
- Ansi to Unicode conversion error (noob) HOT 9
- How to surface azure active directory service principal related errors HOT 3
- Do we need to close cursor in this case? HOT 9
- Connection pooling broken in 5.1.0 or 5.0.1 (with unixODBC 2.3.12)? HOT 3
- pyodbc.Connection' object has no attribute 'columns'
- Can't connect to Microsoft Access in 5.1.0 HOT 4
- Memory allocation error when inserting string of size 128 HOT 6
- SSMS shows "Restoring..." message after this restore command executed from pyodb/python3 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyodbc.