Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

unnecessary overhead traffic

Status
Not open for further replies.

Nordlund

Programmer
Jul 17, 2001
458
SE
Hi all.

I have analyzed the real network traffic when I'm executning a simple Query, e.g. SELECT * FROM TABLE...

Everytime you execute a query, the BDE executes "use databasename" first everytime before your query.

This is often unnecessary overhead traffic because you known which database you are working om (Mostly anyway).

Is there a way to tell the BDE to not send the "use" command?


//Nordlund
 
I'm making the assumption that you're using SQL Server databases ?
Can you not establish whether or not you are connected to the appropriate database already ?
Taking things to the most simplistic approach you could have a global (string) variable in your application that holds the name of the SQL Server database you have most recently connected to, updating it each time you execute the 'USE {databasename}' SQL statement to attach to the required database.
If this global variable (call it 'gbvCurrentDatabase') does not match the name of the database to connect to, then you will need to run the 'USE {databasename}' query, if there is a match then there is no need to run the command as you will already be connected (assuming you have fail-proof code for the maintaining of the variable).
Hope that this helps.
Steve
 
If you are using SQL Server or even Access, use the ADO components on the fly and setup connectionstrings. Stay away from BDE as much as possible, unless, you are using a paradox database. Also select * will make the DBMS go through every field in the database, which is overhead if you are only looking for certain fields, so always specify the fields you are using rather than do *.
 
I think you misunderstand ny question a little bit.
But thanks for the answer anyway...

I do connect to the Database in a correct manner, and I known that I'm connected to the database I want to work with.

The problem is when I'm executing the Query (and I'm not including use statement myself), the BDE automatically send "use databasename" whether I want it or not. One of our customer does indeed complain about this, and claim that this is a unnecessary overhead traffic.
 
Is your TDatabase component set to KeepConnected ?
Or does it re-connect when you open a TQuery (if all other connections through it have been closed) ?
You say that
"The problem is when I'm executing the Query (and I'm not including use statement myself), the BDE automatically send "use databasename" whether I want it or not"
Where are you obtaining this information from ?
How does the customer know that the 'use database' command is being issued ?
Steve
 
Sorry - when I said 'KeepConnected' I meant is the 'KeepConnection' property against the TDatabase component set to True ?
Steve
 
Yep, the KeepConnected property is true.

We are using Microsoft's Network monitor to analyze packets.
And before every question, "use dbname" is sent to the server. Both our customer and I have seen this...

I have been in contact with a Borland Technical Business Development Manager but he couldn't solve this either.

He told me that the problem might be the Session will close when I'm closing the Question, but he wasn't sure why the BDE would send the "use" statement because of that.
 
I'd certainly be interested to know if you get to the bottom of this.
I've never looked into all the commands run against my database as I process TQuery database access.
It's not something we've fallen over.
If you find out the why's and the how to resolve's I would certainly like to hear from you
Thanks
Steve
 
Hi dudes and thank you all for you help.

I solved the problem myself, and it was a little bit easer than I expected.

When you create a databaseconnecteion, you drop a TDatabase and a TQuery on the form. Then you add som parameters such as SERVER NAME and DATABASE NAME.

Skip the DATABASE NAME parameter, and run a "use database"-query after you connected to the database instead.


That solved my problem...
 
Is this the case ?
It's not something I've noticed - but then I haven't been looking for this.
How was your customer picking up on the fact that the 'USE database-name' was being called each time you opened the TQuery ?

Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top