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

  • Home
  • SEARCH
  • 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 8596547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:42:21+00:00 2026-06-12T00:42:21+00:00

I need help with database connections and my winapp. I have a windows app

  • 0

I need help with database connections and my winapp.

I have a windows app (C#) that, after I log in, starts running 5 or 6 different queries in Oracle database, every 5-10 seconds. Application is up 24/7.

What is a proper way to do this?
Should I open connection during login and never close it until I close the app, or should I open and close connection every time I run a query?
For example:

//first query
conn.Open();
DataSet ds1 = new DataSet();

string sql = "SELECT * FROM table1";

OracleCommand cmd = new OracleCommand(sql, conn);
cmd.CommandType = CommandType.Text;
OracleDataAdapter da = new OracleDataAdapter(cmd);
da.Fill(ds1, "Result1");
conn.Dispose();

return ds1;

//second query    
conn.Open();
DataSet ds2 = new DataSet();

string sql = "SELECT * FROM table2";

OracleCommand cmd = new OracleCommand(sql, conn);
cmd.CommandType = CommandType.Text;
OracleDataAdapter da = new OracleDataAdapter(cmd);
da.Fill(ds2, "Result2");
conn.Dispose();

return ds2;

What’s the best way to do this?

  • 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-12T00:42:22+00:00Added an answer on June 12, 2026 at 12:42 am

    The Oracle OleDB provider you use in your application implements pooling. So, when you create and clore a connection, you only take/release a connection from a pool of ‘real connection’.

    This makes creating and disposing Connection objects a really cheap operation. If I were you, I would open a connection, execute my batch of queries, and close+dispose that connection as soon as I’m done and going to sleep (even for a few seconds).

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

Sidebar

Related Questions

need help in error in database pivot. i have table tamed table_score like below:
I need some help a query. For each movie in my database that has
Need help with a query that I wrote: I have three tables Company id
I need help with displaying images from a MySQL database. What I have is
I need help with displaying images from a MySQL database. What I have is
I need help on the best way to design a database/tables for the following
I need your help with display of some comma separated enteries from my database.
I'm in need of help - I've got two mysql databases on different servers
I have a simple .NET 3.5 app for changing some database fields using an
I need help figuring out an error in my SQL statement. I have been

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.