I'm querying MS SQL using python using the source code from http://www.ironpython.info/index.php/Accessing_SQL_Server:
import clr
clr.AddReference('System.Data')
from System.Data import *
TheConnection = SqlClient.SqlConnection
("server=yourserver;database=News;uid=sa;password=password;timeout=0")
TheConnection.Open()
MyAction = SqlClient.SqlCommand("Select Headline from News", TheConnection)
MyReader = MyAction.ExecuteReader()
while MyReader.Read():
print MyReader[0]
MyReader.Close()
TheConnection.Close()
I just added timeout=0, but still I got : EnvironmentError: System.Data.SqlClient.SqlException (0x80131904): Timeout expir ed. The timeout period elapsed prior to completion of the operation or the serv er is not responding.
I tried it with timeout=1000000, but still got the same error.
If I run the same SQL in the same machine using the MSSQL Client, it's totally fine. Do you know how to avoid this timeout exception?
Thanks in advance!