Timeout for OracleConnection

0

I have a function to open the banks connection in Oracle and in this function I want to put a time limit on the attempt to connect to the bank.

I tried to use ConnectionString this way

oConexao.ConnectionString = "Data Source = MeuBd; User Id = MeuID; Password = 88997k21; Connection Timeout = 10;"

But it did not work, falling into an Exception and saying that the keyword 'connectiontimeout' is not supported.

Function:

Private Shared Function AbrirConexaoOracle(ByVal sNomeBanco As String, Optional ByRef mensagem As String = "") As OracleClient.OracleConnection

        Dim oConexao As OracleClient.OracleConnection

        Try
            oConexao = New OracleClient.OracleConnection
            If sNomeBanco = "OUTROS" Then
                oConexao.ConnectionString = mensagem
                mensagem = String.Empty
            Else
                oConexao.ConnectionString = LerConnectionString(sNomeBanco) 'MontarConnectionString(sNomeBanco)
            End If                
            oConexao.Open()
        Catch ex As Exception
            mensagem = ex.Message.ToString
            If Not oConexao Is Nothing Then
                oConexao.Close()
                oConexao.Dispose()
            End If
        End Try
        Return oConexao

    End Function

How can I give this limit to the connection attempt in case of OracleConnection ?

    
asked by anonymous 09.10.2014 / 13:46

0 answers