Showing posts with label concerning. Show all posts
Showing posts with label concerning. Show all posts

Sunday, February 12, 2012

Connection problems from VB

When monitoring errors concerning connection and updating data on my MS SQL
Server2000 from a VB application I get these errors.
-2147467259 [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionWrite
(send()).
-2147467259 [Microsoft][ODBC SQL Server Driver]Connection error
-2147467259 [Microsoft][ODBC SQL Server Driver][SQL
Server]SqlDumpExceptionHandler: Process 79 generated fatal exception
c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process.
-2147467259 [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionWrite
(send()).
The application has been communicating with an MS SQL Server2000 for 5-6
years with no problems of this kind. The problem started when I installed my
application to run against a new MS SQL Server2000 at a new company, and I
am wondering if it could have something to do with how the server is
configured.
I am not sure why the err.description ref. to ODBC SQL Server Driver because
as shown below I use OLEDB connection object.
Any Ideas on how to manage this problem?
Below you can see example of my functions in VB:
Private Sub cmdSelect_Click()
funConnect
set rstMyRecordset = rstExecData(mySelectSQL)
funDisconnect
End Sub
this procedure works just fine
this next code works fine as well, but if I try to run a select as above
after the update if fails with the error in function rstExecData
Private Sub cmdUpdate_Click()
funConnect
rstExecData(myUpdateSQL)
funDisconnect
End Sub
Functions used:
Function funConnect() As Boolean
On Error GoTo errHandler
strCnn =
" driver={SQLServer};server=DC01;uid=sa;pw
d=mysapassword;database=mydatabase"
Set cnn = New ADODB.Connection
cnn.CursorLocation = adUseClient
cnn.Open strCnn
Exit Function
errHandler:
funConnect = False
End Function
Function funDisconnect() As Boolean
On Error GoTo errHandler
If cnn.State = 1 Then
Set cnn = Nothing
Else
Exit Function
End If
errHandler:
funDisconnect = False
End Function
Public Function rstExecData(strSQL As String) As ADODB.Recordset
Set rstExecData = New ADODB.Recordset
rstExecData.CursorType = adOpenDynamic
rstExecData.LockType = adLockOptimistic
rstExecData.Open Trim(strSQL), cnn
End Function
TIRislaaWhat about following line:
strCnn =
" driver={SQLServer};server=DC01;uid=sa;pw
d=mysapassword;database=mydatabase"
This is call to OLEDB for ODBC Provider and ODBC Driver.
Why not OLEDB Driver for SQL Server?
strCnn = "Provider=SQLOLEDB.1;Data Source=DC01;Password=mysapassword;User
ID=sa;Initial Catalog=mydatabase;"
Regards
Jacek
"Tor Inge Rislaa" wrote:

> When monitoring errors concerning connection and updating data on my MS SQ
L
> Server2000 from a VB application I get these errors.
>
> -2147467259 [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionWrite
> (send()).
> -2147467259 [Microsoft][ODBC SQL Server Driver]Connection error
> -2147467259 [Microsoft][ODBC SQL Server Driver][SQL
> Server]SqlDumpExceptionHandler: Process 79 generated fatal exception
> c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this proces
s.
>
> -2147467259 [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionWrite
> (send()).
>
> The application has been communicating with an MS SQL Server2000 for 5-6
> years with no problems of this kind. The problem started when I installed
my
> application to run against a new MS SQL Server2000 at a new company, and I
> am wondering if it could have something to do with how the server is
> configured.
>
> I am not sure why the err.description ref. to ODBC SQL Server Driver becau
se
> as shown below I use OLEDB connection object.
>
> Any Ideas on how to manage this problem?
>
>
> Below you can see example of my functions in VB:
>
> Private Sub cmdSelect_Click()
> funConnect
> set rstMyRecordset = rstExecData(mySelectSQL)
> funDisconnect
> End Sub
> this procedure works just fine
> this next code works fine as well, but if I try to run a select as above
> after the update if fails with the error in function rstExecData
> Private Sub cmdUpdate_Click()
> funConnect
> rstExecData(myUpdateSQL)
> funDisconnect
> End Sub
> Functions used:
>
> Function funConnect() As Boolean
> On Error GoTo errHandler
> strCnn =
> " driver={SQLServer};server=DC01;uid=sa;pw
d=mysapassword;database=mydatabas
e"
> Set cnn = New ADODB.Connection
> cnn.CursorLocation = adUseClient
> cnn.Open strCnn
> Exit Function
> errHandler:
> funConnect = False
> End Function
>
> Function funDisconnect() As Boolean
> On Error GoTo errHandler
> If cnn.State = 1 Then
> Set cnn = Nothing
> Else
> Exit Function
> End If
>
> errHandler:
> funDisconnect = False
> End Function
> Public Function rstExecData(strSQL As String) As ADODB.Recordset
> Set rstExecData = New ADODB.Recordset
> rstExecData.CursorType = adOpenDynamic
> rstExecData.LockType = adLockOptimistic
> rstExecData.Open Trim(strSQL), cnn
> End Function
> TIRislaa
>
>
>|||This connectionstring works OK for select statements, but if I try to update
data, the application hangs totally (don't answer)
Is it possible that there are settings on the SQL server that blocks update
and insert statements?
TIRislaa
"JacekZ" <JacekZ@.discussions.microsoft.com> skrev i melding
news:0B026699-EDBA-4B7E-8B1F-BFCED79AA73E@.microsoft.com...
> What about following line:
> strCnn =
> " driver={SQLServer};server=DC01;uid=sa;pw
d=mysapassword;database=mydatabas
e"
> This is call to OLEDB for ODBC Provider and ODBC Driver.
> Why not OLEDB Driver for SQL Server?
> strCnn = "Provider=SQLOLEDB.1;Data Source=DC01;Password=mysapassword;User
> ID=sa;Initial Catalog=mydatabase;"
>
> Regards
> Jacek
> "Tor Inge Rislaa" wrote:
>