Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8488191
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:27:53+00:00 2026-06-10T21:27:53+00:00

I seem to be getting intermittent problems with my Oracle connection indicating something about

  • 0

I seem to be getting intermittent problems with my Oracle connection indicating something about a problem with semaphores which suggest that Oracle is somehow holding onto the connections instead of removing them after they have been used.

Here’s the code and connection string I use:

Connection string: user id=user;password=password;data source=dataSource; Validate Connection=true;Min Pool Size=10;Connection Lifetime=5;Connection Timeout=60;Incr Pool Size=5;

And the code I use is this:

Dim OracleConn As New OracleConnection()
Dim DataTable As DataTable
Dim queryOracle As OracleCommand
Dim OracleDataAdapter As OracleDataAdapter
Dim connStr As String = "user id=user;password=password;data source=dataSource; Validate Connection=true;Min Pool Size=10;Connection Lifetime=5;Connection Timeout=60;Incr Pool Size=5;"
OracleConn.ConnectionString = connStr

Try

            OracleConn.Open()

            queryOracle = OracleConn.CreateCommand()

            queryOracle.CommandText = "select * from table1"

            DataTable = New DataTable()
            OracleDataAdapter = New OracleDataAdapter(queryOracle)
            OracleDataAdapter.Fill(DataTable)

            table1.DataSource = DataTable.DefaultView
            table1.DataBind()

        Catch OracleEx As OracleException
            Throw
        Catch ex As Exception
            Throw
        Finally

            If Not OracleConn Is Nothing And OracleConn.State = ConnectionState.Open Then
                OracleConn.Close()
            End If

        End Try

Now my questions are:

  1. Is this the best way of doing this?
  2. I only “Close” my connection do I need to “Dispose” of it also?

I’m using Oracle.DataAccess.Client by the way.

Any help will be much appreciated

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T21:27:54+00:00Added an answer on June 10, 2026 at 9:27 pm

    Try to put everything between Using.

    Using oracleConn as OracleConnection = new OracleConnection()
    'Your stuff goes here
    End Using
    

    the same goes for Commands.

    P.S. There’s is no need to catch Exception if they are just thrown again.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm getting errors and warnings that seem to indicate that 4th edition examples are
I seem to have a problem with getting MVC to fill in my custom
Well.. it's pretty much that, I seem to be getting a Illegal Seek error
I seem to be getting a type mismatch error when trying to do something
I seem to be getting a new error when using LLVM Compiler 2.0, which
I seem to be getting an array out of bounds exception but the problem
I seem to be getting this particular always when i am trying to receive
I seem to be getting the above error when trying to make a callable
I've been coding for a while now but seem to be getting this issue
Spent a good few hours on this now and don't seem to be getting

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.