Microsoft SQL Server
--
Questions
--
Followers
Top Experts
ADODB::_ConnectionPtr DBConn = NULL;
ADODB::_RecordsetPtr RecSet = NULL;
TESTHR(DBConn.CreateInstan
DBConn->CommandTimeout = 300; Â Â // Added when number of records got large
DBConn->Open(_bstr_t("DSN=
     Â
TESTHR(RecSet.CreateInstan
RecSet->Open("DBTestTable"
Over time time and testing, the number of entries in the table have gotten very large. Â I did not originally have the CommandTimeout defined and the RecSet->Open() would timeout. Â I added an arbitrary value to see if that would solve the open problem and it did. Â However, the table is now even larger and the RecSet->Open() is starting to timeout again.
I would like to approach this in two manners:
#1. Â The "write" program is not concerned with the entries already in the table. Â If possible, I would like to open the recordset in a manner that I can add new records but it does not need to access all the existing records to perform it's function so in theory a timeout value is not needed.
#2. Â The "read" program does need to access a undetermined amount of the database based on user input. Â Basically, the provde a starting and stopping date/time range and all records are returned for that range. Â With alot of records, I can see why it might take awhile for a response and a timeout could happen. Â Is there a faster way to speed up the database response without having to prompt the user for a specified wait time or can I recover from the timeout, warn the user things are still happening, and continue the search.
I'm new to ADO and have been working my way thru it but I'm a little stuck here. Â Is it possibile to perform the RecordSet opens in the 2 different manners described without having to provide a timeout value -- either at the user interface level or in some configuration file?
Zero AI Policy
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
#1. Â The "write" program is a constant activity program. Â It is constantly collecting data thru a network socket from a remote system and writing the data to the SQL Server. Â That's part of the reason that I open it the one time and then do multiple writes to the database. Â I'm doing the ADO AddNew() and Update() calls to add records.
#2. Â Both programs are not MicroSoft SQL dependant. Â They need to be able to run with whatever the desired database environment happens to be -- be it MySQL, PostgreSQL, Oracle, etc. Â Currently, I have the programs are running with MicroSoft SQL and MySQL environment. Â We have not created the large database environment yet in MySQL so I don't know if I will have similar problems or not.
Optimizing queries is something that needs to be done specific to each database system, and an optimized query that works perfectly on SQL Server might not necessarily work on Oracle. You won't get good performance by using exactly the same methods/queries for each database system.
I'd suggest that you need to do something like this (pseudo code):
If DatabaseSystem is SQL Server
   Call this stored procedure
Else if it's Oracle
   Run this oracle-specific query
Else if it's Cache
   Run this Cache-specific query
Thanks
Mark






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
HTH
Microsoft SQL Server
--
Questions
--
Followers
Top Experts
Microsoft SQL Server is a suite of relational database management system (RDBMS) products providing multi-user database access functionality.SQL Server is available in multiple versions, typically identified by release year, and versions are subdivided into editions to distinguish between product functionality. Component services include integration (SSIS), reporting (SSRS), analysis (SSAS), data quality, master data, T-SQL and performance tuning.