Comments (6)
Would you want the connection to die past a certain limit or do you want to extend the limit?
from django-pyodbc.
For the connection to die past a certain limit so the user gets a quicker response.
from django-pyodbc.
I think this may be something you need to do on the database server itself (e.g., through SQL Server). @michiya what do you think?
from django-pyodbc.
Hi guys,
If you are using FreeTDS, you might be able to specify timeout values with timeout
or connect timeout
settings in freetds.conf. For more details, see:
http://freetds.schemamania.org/userguide/freetdsconf.htm
But if you are using MS ODBC drivers, probably there's no way to specify timeout values at this time because they don't support Connect Timeout
keyword in the connection string.
And now, pyodbc provides the following way to specify timeout values:
timeout
kwarg in podbc.connect()
this represents SQL_ATTR_LOGIN_TIMEOUT in the ODBC spec.timeout
attribute of Connection object
this represents SQL_ATTR_CONNECTION_TIMEOUT and SQL_ATTR_QUERY_TIMEOUT in the ODBC spec.
and you can specify timeout values with pyodbc like this:
# connect to the database in 3 seconds
conn = pyodbc.connect(connstr, timeout=3)
# set connection/query timeout to 5 seconds
conn.timeout = 5
So it might be a good idea to slightly modify the backend as above to accept these timeout-related options in the database settings.
from django-pyodbc.
Thanks for the info guys!
On Thu, Aug 1, 2013 at 3:21 AM, Michiya Takahashi
[email protected]:
Hi guys,
If you are using FreeTDS, you might be able to specify timeout values with
timeout or connect timeout settings in freetds.conf. For more details,
see:
http://freetds.schemamania.org/userguide/freetdsconf.htmBut if you are using MS ODBC drivers, probably there's no way to specify
timeout values at this time because they don't support Connect Timeoutkeyword in the connection string.And now, pyodbc provides the following way to specify timeout values:
timeout kwarg in podbc.connect()
this represents SQL_ATTR_LOGIN_TIMEOUT in the ODBC spec.timeout attribute of Connection object
this represents SQL_ATTR_CONNECTION_TIMEOUT and SQL_ATTR_QUERY_TIMEOUT
in the ODBC spec.and you can specify timeout values with pyodbc like this:
connect to the database in 3 secondsconn = pyodbc.connect(connstr, timeout=3)# set connection/query timeout to 5 secondsconn.timeout = 5
So it might be a good idea to slightly modify the backend as above to
accept these timeout-related options in the database settings.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/18#issuecomment-21917075
.
from django-pyodbc.
@dlo I will add support for these timeout-related database options to the backend if you agree with that. What do you think of that?
from django-pyodbc.
Related Issues (20)
- aggregate_select() removed in Django 1.10 HOT 2
- OpenEdge support not working in master. Some basic fixes here
- django.core.exceptions.ImproperlyConfigured: Django 1.11 is not supported. HOT 4
- as_sql() got an unexpected keyword argument 'subquery' HOT 5
- Please update for Django 1.11.1 HOT 5
- Conversion failed when converting date and/or time from character string. HOT 2
- pyodbc.DataError: Conversion failed when converting da te and/or time from character string HOT 1
- SchemaEditor error HOT 1
- unixODBC config files HOT 1
- Using for dbf files HOT 1
- Django 2.0 Alpha inspectdb command fails
- django-pyodbc query with OFFSET+LIMIT issue
- Active maintainer needed HOT 9
- No default encoding (2.0.0a1) HOT 3
- Error: SchemaEditorClass HOT 1
- Different schemas in models.py HOT 1
- django odbc connection to production SQL server 2014 from windows machine HOT 1
- Help in setting up connection with load balancer HOT 1
- Sql server 2019 connection string issue from django project HOT 1
- Database error conection using django-pyodbc to connect to SQL Server 2019 HOT 1
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 django-pyodbc.