Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Unhandled exception on next query after network connection is disconnected then re-connected. #90

Open
@tazervas

Description

@tazervas

If the network connection is lost and then re-connected during an ODBC session using version 17.00.0004 the next query will throw an "Attempted to read or write protected memory" exception which cannot be caught. Version 16.00.00 throws exception "The connection has been disabled (or lost). ERROR [08S01] server closed the connection unexpectedly" which can be caught and acted upon which is the desired behavior.

Example Visual Studio 2022 .NET 8 Windows Forms Visual Basic code which demonstrates this issue:

    Try        Dim cs As New Odbc.OdbcConnectionStringBuilder        cs.Clear()        cs.Driver = "PostgreSQL Unicode(x64)"        cs.Add("Database", "database")        cs.Add("Servername", "host")        cs.Add("UID", "user")        cs.Add("PWD", "password")        Dim c As Odbc.OdbcConnection = New Odbc.OdbcConnection With {.ConnectionString = cs.ConnectionString}        c.Open()        Dim sql As Odbc.OdbcCommand = c.CreateCommand        sql.CommandType = CommandType.Text        sql.CommandText = "SELECT count(*) FROM anytable"        sql.ExecuteScalar()        MsgBox("psqlODBC exception test: disconnect then re-connect network")        sql.ExecuteScalar()     ' unhandled exception here    Catch ex As Exception        MsgBox(ex.ToString)    End Try

Exception text:

System.AccessViolationException
HResult=0x80004003
Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Source=
StackTrace:

[Managed to Native Transition]System.Data.Odbc.dll!System.Data.Odbc.OdbcConnectionHandle.ReleaseHandle()UnknownSystem.Private.CoreLib.dll!System.Runtime.InteropServices.SafeHandle.InternalRelease(bool disposeOrFinalizeOperation)UnknownSystem.Private.CoreLib.dll!System.Runtime.InteropServices.SafeHandle.Dispose()UnknownSystem.Data.Odbc.dll!System.Data.Odbc.OdbcConnection.Close()UnknownSystem.Data.Odbc.dll!System.Data.Odbc.OdbcConnection.ConnectionIsAlive(System.Exception innerException)UnknownSystem.Data.Odbc.dll!System.Data.Odbc.OdbcConnection.HandleErrorNoThrow(System.Data.Odbc.OdbcHandle hrHandle, System.Data.Odbc.ODBC32.SQLRETURN retcode)UnknownSystem.Data.Odbc.dll!System.Data.Odbc.OdbcConnection.HandleError(System.Data.Odbc.OdbcHandle hrHandle, System.Data.Odbc.ODBC32.SQLRETURN retcode)UnknownSystem.Data.Odbc.dll!System.Data.Odbc.OdbcCommand.ExecuteReaderObject(System.Data.CommandBehavior behavior, string method, bool needReader, object[] methodArguments, System.Data.Odbc.ODBC32.SQL_API odbcApiMethod)UnknownSystem.Data.Odbc.dll!System.Data.Odbc.OdbcCommand.ExecuteReaderObject(System.Data.CommandBehavior behavior, string method, bool needReader)UnknownSystem.Data.Odbc.dll!System.Data.Odbc.OdbcCommand.ExecuteScalar()Unknown

psqlodbc_17_0004_exception.dll!psqlodbc_17_0004_exception.Form1.Form1_Load(Object sender, System.EventArgs e) Line 43Basic

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp