plz help.....
this is my connection method to postgresDB
Public Function GenConnection() As NpgsqlConnection
Dim Connection As New NpgsqlConnection("Server=" & gstrServerName & ";Port=" & gstrPort & ";Database=" & gStrDBName & ";Pooling=false;MINPOOLSIZE=0;CONNECTIONLIFETIME=0;COMMANDTIMEOUT=0;MAXPOOLSIZE=100;Username=" & gstrUserName & ";Password=" & gPassword)
Try
If Connection.State = ConnectionState.Open Then
Connection.Close()
End If
Connection.ClearAllPools()
Connection.Open()
gblnValidConnection = True
Return Connection
Catch ex As Exception
gblnValidConnection = False
MsgBox(ex.Message)
End Try
End Function
and the above mentioned problem occuring unexpectdly in datareader and datatable ....
Public Function GetDataTable(ByVal cmdText As String) As DataTable
Dim dt As New DataTable
Dim command As New NpgsqlCommand(cmdText, GenConnection)
Dim dataAdapter As New NpgsqlDataAdapter(command)
Try
dataAdapter.Fill(dt)
GenConnection.Close()
GenConnection.ClearAllPools()
Return dt
Catch exc As NpgsqlException
MessageBox.Show(exc.ToString())
ThrowNpgsqlException(exc)
Catch ex As Exception
MessageBox.Show(ex.ToString())
ErrorLogging(DateAndTime.Now)
ErrorLogging(ex.ToString)
Dim errObj As New FrmError
errObj.GenErr.DisplayError(ex.Message, ex.ToString)
errObj.ShowDialog()
End Try
End Function
and
Public Function GetDataReader(ByVal cmdText As String) As NpgsqlDataReader
Dim dr As NpgsqlDataReader
Dim command As New NpgsqlCommand(cmdText, GenConnection)
Try
dr = command.ExecuteReader
Return dr
Catch exc As NpgsqlException
ThrowNpgsqlException(exc)
Catch ex As Exception
ErrorLogging(DateAndTime.Now)
ErrorLogging(ex.ToString)
Dim errObj As New FrmError
errObj.GenErr.DisplayError(ex.Message, ex.ToString)
errObj.ShowDialog()
End Try
End Function
i got this from pg_log
2013-08-23 11:43:03 IST LOG: setsockopt(TCP_KEEPCNT) not supported
2013-08-23 11:31:45 IST LOG: could not receive data from client: No connection could be made because the target machine actively refused it.
Edited by viveq, 22 August 2013 - 10:15 PM.