Showing posts with label objconn. Show all posts
Showing posts with label objconn. Show all posts

Thursday, March 22, 2012

ConnectionTimeout

I'm creating connection object to SQL Server db this way
Set objConn = New ADODB.Connection
objConn.CursorLocation = adUseClient
objConn.ConnectionString =
"PROVIDER=MSDASQL;dsn=Coordinator;uid=vladc;pwd=de veloper4444;database=SRS;"
objConn.ConnectionTimeout = 1
objConn.Open
It doesn't matter what value I'm setting to the ConnectionTimeout property.
If server is unavailable then it produces an error only after approximately
30 seconds. I read in MSDN than default ConnectionTimeout is 15 seconds. If
I comment assignment line in my code, it's still about 30 seconds.
So, for me ConnectionTimeout property doesn't work.
What am I doing wrong?
Thank you
Vlad
objConn.ConnectionTimeout = 30
Vctor Koch From Argentina.
"Vlad" <vovan.c@.verizon.net> escribi en el mensaje
news:O$JZcAuWEHA.3664@.TK2MSFTNGP12.phx.gbl...
> I'm creating connection object to SQL Server db this way
> Set objConn = New ADODB.Connection
> objConn.CursorLocation = adUseClient
> objConn.ConnectionString =
>
"PROVIDER=MSDASQL;dsn=Coordinator;uid=vladc;pwd=de veloper4444;database=SRS;"
> objConn.ConnectionTimeout = 1
> objConn.Open
> It doesn't matter what value I'm setting to the ConnectionTimeout
property.
> If server is unavailable then it produces an error only after
approximately
> 30 seconds. I read in MSDN than default ConnectionTimeout is 15 seconds.
If
> I comment assignment line in my code, it's still about 30 seconds.
> So, for me ConnectionTimeout property doesn't work.
> What am I doing wrong?
> Thank you
> Vlad
>
|||"Vlad" <vovan.c@.verizon.net> wrote in message
news:O$JZcAuWEHA.3664@.TK2MSFTNGP12.phx.gbl...

> I'm creating connection object to SQL Server db this way
> Set objConn = New ADODB.Connection
> objConn.CursorLocation = adUseClient
> objConn.ConnectionString =
>
"PROVIDER=MSDASQL;dsn=Coordinator;uid=vladc;pwd=de veloper4444;database=SRS;"
> objConn.ConnectionTimeout = 1
> objConn.Open
Why use ODBC to connect to SQL Server? Why not use the native SQL OLE DB
provider?
|||"Vlad" <vovan.c@.verizon.net> wrote in message
news:O$JZcAuWEHA.3664@.TK2MSFTNGP12.phx.gbl...

> I'm creating connection object to SQL Server db this way
> Set objConn = New ADODB.Connection
> objConn.CursorLocation = adUseClient
> objConn.ConnectionString =
>
"PROVIDER=MSDASQL;dsn=Coordinator;uid=vladc;pwd=de veloper4444;database=SRS;"
> objConn.ConnectionTimeout = 1
> objConn.Open
Why use ODBC to connect to SQL Server? Why not use the native SQL OLE DB
provider?

ConnectionTimeout

I'm creating connection object to SQL Server db this way
Set objConn = New ADODB.Connection
objConn.CursorLocation = adUseClient
objConn.ConnectionString =
" PROVIDER=MSDASQL;dsn=Coordinator;uid=vla
dc;pwd=developer4444;database=SRS;"
objConn.ConnectionTimeout = 1
objConn.Open
It doesn't matter what value I'm setting to the ConnectionTimeout property.
If server is unavailable then it produces an error only after approximately
30 seconds. I read in MSDN than default ConnectionTimeout is 15 seconds. If
I comment assignment line in my code, it's still about 30 seconds.
So, for me ConnectionTimeout property doesn't work.
What am I doing wrong?
Thank you
VladobjConn.ConnectionTimeout = 30
Vctor Koch From Argentina.
"Vlad" <vovan.c@.verizon.net> escribi en el mensaje
news:O$JZcAuWEHA.3664@.TK2MSFTNGP12.phx.gbl...
> I'm creating connection object to SQL Server db this way
> Set objConn = New ADODB.Connection
> objConn.CursorLocation = adUseClient
> objConn.ConnectionString =
>
" PROVIDER=MSDASQL;dsn=Coordinator;uid=vla
dc;pwd=developer4444;database=SRS;"
> objConn.ConnectionTimeout = 1
> objConn.Open
> It doesn't matter what value I'm setting to the ConnectionTimeout
property.
> If server is unavailable then it produces an error only after
approximately
> 30 seconds. I read in MSDN than default ConnectionTimeout is 15 seconds.
If
> I comment assignment line in my code, it's still about 30 seconds.
> So, for me ConnectionTimeout property doesn't work.
> What am I doing wrong?
> Thank you
> Vlad
>|||"Vlad" <vovan.c@.verizon.net> wrote in message
news:O$JZcAuWEHA.3664@.TK2MSFTNGP12.phx.gbl...

> I'm creating connection object to SQL Server db this way
> Set objConn = New ADODB.Connection
> objConn.CursorLocation = adUseClient
> objConn.ConnectionString =
>
" PROVIDER=MSDASQL;dsn=Coordinator;uid=vla
dc;pwd=developer4444;database=SRS;"
> objConn.ConnectionTimeout = 1
> objConn.Open
Why use ODBC to connect to SQL Server? Why not use the native SQL OLE DB
provider?

Tuesday, February 14, 2012

connection sql server problems

What is the problems of my code to connect sql database below : thx!
Code:
Dim objConn As New OleDbConnection()
objConn.ConnectionString = "Data Source=localhost;IntegratedSecurity=SSPI;user id=sa; password=sa;Initial Catalog=rental"

objConn.Open()
Error :

An OLE DB Provider was not specified in the ConnectionString. An example would be, 'Provider=SQLOLEDB;'.

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details:System.ArgumentException: An OLE DB Provider was not specified in the ConnectionString. An example would be, 'Provider=SQLOLEDB;'.
Source Error:
Line 7: Line 8: Dim objConn As New OleDbConnection()Line 9: objConn.ConnectionString = "Data Source=localhost;IntegratedSecurity=SSPI;user id=sa; password=sa;Initial Catalog=rental"Line 10: Line 11: objConn.Open()
Your connection string is appropriate for a SqlConnection object. If you want to use an OledbConnection (which is slower), you'll have to specify Provider=sqloledb
Marcie