|
I’ve used ADO for about 5 years now but only in single threaded applications. I’m going to begin work on an application that needs to have some worker threads connecting to a MS SQL Server. We figure that under worst-case scenario there could be 200 threads all executing queries against the db. Under an average load it will probably be more like 50 threads with db connections.
This application needs to be a stand-alone EXE (with a few dlls etc) therefore I can’t use MTS or some other middle-tier that would maintain a connection pool.
I really don’t want to create a new connection to the db each time I fire off a worker thread. Its not possible to share the same connection across the threads (right?) because I sure don’t want to serialize access to the single connection.
Has anyone else had to do something similar? Any design suggestions and ideas on how to implement this would be greatly appreciated.
Thanks in advance!
|
|
|
|
|
You can use a thread pool, each thread having its own DB connection that is active during the entire liftime of the thread itself. So, after a thread has executed a query, instead of terminating it can go to a "pending" state, ready to serve additional queries. This way you don't have the penaly of creating a thread and creating a DB connection each time a query has to be executed. Of course this needs some working out (is it the pool fixed, or do it vary in time according to the frequency of queries, etc.) but I think the approach can be appropriate.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hey Joaquín,
If i did go with some sort of connection pooling module how would one pass an ADO connection across threads. In MFC its often tough to pass objects across threads. Would I somehow allocate the connection on the heap and pass a pointer to it?
|
|
|
|
|
There's no problem at all with passing pointers to memory around threads within the same process. However, in my proposed scheme this is not necessary, as each thread can maintain its own DB connection. The improvement in efficiency results from the threads not closing its connections, but instead reusing it each time they're re-activated. As an added benefit, the architecture is simple with respect to concurrency issues (essentially, threads do not share any resource with each other).
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hello!
I'm currently working on a big project which uses a Microsoft Access database as the backend for storing data. This application is possibly going to be distributed commercially, so I need to know what is my best bet on what kind of database to use. With Access right now I can manipulate the database with a good level of control and ease of coding, but I'm sort of worried about the problems I might have distributing it, since people might not have Access drivers installed on their computers, or it might be painfully slow on slower computers. One of my biggest concerns is the speed of the database for a LARGE dataset, for instance north of 20,000 rows in one table, around 1,000 for two other tables.
Can anyone point me to a nice comparison chart or lay down some information for different databases as far as concerns the speed, the overhead, the ease of installation on a user's machine? I would be very appreciative!
Also, does anyone know a good place to start if I'm interested in creating a Visual C++ application which uses the MySQL database?
Thanks in advance!
Sincerely,
Alexander Wiseman
Est melior esse quam videri
It is better to be than to seem
|
|
|
|
|
|
I want to paint something outside of the client rect, but how to get that area?
Who can help me out? I would like to know if there is a function that returns a CRect.
Thanks
|
|
|
|
|
GetWindowRect returns that. Note that returned rect is in screen coordinates.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
|
How can I change the size of a Title Bar? I tried changing the CREATESTRUCT of the WM_NCCREATE message, but that didn't work...
Thanks in advance
|
|
|
|
|
|
"The WM_NCCALCSIZE message is sent when the size and position of a window's client area must be calculated. By processing this message, an application can control the content of the window's client area when the size or position of the window changes." - MSDN
I know it must be possible, as the size of the Title Bar changes when the dialog is a 'Tool window'
Can somebody please help me out? Some source code would be greatly appreciated.
|
|
|
|
|
So what's the problem? Capture the message and return the client area small or big enough for given titlebar size.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
See this article for funky nonclient area drawing tricks.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Thanks! That might be what I'm looking for.
|
|
|
|
|
i have a 1 to many dialog
i show one record of many and have a list showing all.
i would like have the list hilight the current record while either browsing or editting the current one.
So my actual question is:
Is there a way to hilight a row on a listcontrol without having focus?
|
|
|
|
|
|
i have tried that but the row is only hilighted with the control has focus.
as soon as focus is lost the hilight also goes away.
would be greatful for anyother suggestions. thank you.
|
|
|
|
|
Do you have 'Show selection always' option set in the dialog editor?
If you're creating list control dynamically, use LVS_SHOWSELALWAYS style.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
that is exactly the problem. thank you very much.
|
|
|
|
|
Hi ,
I am trying to create an editor similar to MS VisualStudio's
Resource Editor for Dialog.
In this I need to create a Label, which would contain Text
and be dragged around and also be resized.
Can some one tell me how it can be done.
Thanks,
Sansky
|
|
|
|
|
Howdy,
I think you would need to override several mouse functions in your Label class to do the following:
OnLButtonDown: Track when the user clicks and if they have the left button down so that you can know what to do when they move the mouse
OnLButtonUp: Again, use this to remember the mouse button state
OnMouseMove: Inside here test to find out if the mouse button is down and if so, use MoveWindow to move your window to the same coordinates as the mouse is moving to
I think that should do it, but this is just a guess. Hope it gives you a good direction to start looking...
Dave
|
|
|
|
|
Hi,
Thanks, What I need is, how do I create, display ,move and
resize Label
Also I might need to display the Label in the CView, as I
am not sure if I could drag and resize objects in CDialog.
Any suggestions
Regards,
Sansky
|
|
|
|
|
Is there a way to use something like the Internet Explorer "Save as" method in my own programs? I want to save a webpage including the images...
Is there a method / macro to use or do i have to do it all manually ( extracting the tags etc..)?
Thanks for your help...
|
|
|
|
|
Hello,
My application need during execution
to dinamically load a driver (.sys).
How can I do this programatically?
Also, how can I use Visual C++ to
compile a driver? I search in MSDN
and fount at visual c++ linker options
"Use the /DRIVER linker option to build a Windows NT kernel mode driver. ". But how should I use this? I can't figure myself.
Thanks
|
|
|
|