Click here to Skip to main content
15,916,091 members
Home / Discussions / Database
   

Database

 
AnswerRe: Why won't database shrink using MSDE? Pin
AndyG25-Oct-01 16:15
AndyG25-Oct-01 16:15 
GeneralRe: Why won't database shrink using MSDE? Pin
25-Oct-01 21:35
suss25-Oct-01 21:35 
GeneralNumeric Datatype Pin
Michael Martin24-Oct-01 20:52
professionalMichael Martin24-Oct-01 20:52 
GeneralRe: Numeric Datatype Pin
SasaT19-Nov-01 23:44
SasaT19-Nov-01 23:44 
GeneralChecking flag adFldIsNullable with Field "Attributes" property Pin
24-Oct-01 2:33
suss24-Oct-01 2:33 
GeneralSQL Query Pin
Drawil23-Oct-01 10:39
Drawil23-Oct-01 10:39 
GeneralRe: SQL Query Pin
Drawil23-Oct-01 22:07
Drawil23-Oct-01 22:07 
GeneralADO Resource pooling Pin
Alberto Richart23-Oct-01 6:20
Alberto Richart23-Oct-01 6:20 
Hi all,

I have been testing the connection pooling in ADO 2.6, and seems to work fine. By changing the OLE DB Services parameter I have seen how the pooling is enabled or disabled, in this way:


Private Declare Function GetTickCount Lib "kernel32" () As Long

Private Sub Command1_Click()
Dim start, finish, duration As Long

Dim conn, conn2, conn3, conn4 As ADODB.Connection

Dim strConn
strConn = "Provider=SQLOLEDB.1;Persist Security Info=False;Data Source=ALBERT;Initial Catalog=MyCatalog;User ID=arichart;Trusted_Connection=Yes;OLE DB Services = -2;"
'Conn1
start = GetTickCount()
Set conn = New ADODB.Connection
conn.ConnectionString = strConn
conn.CursorLocation = adUseClient
conn.Open

finish = GetTickCount()
duration = finish - start
Debug.Print "Duration 1: " & Str(duration)
conn.Close
Set conn = Nothing

'Conn2
start = GetTickCount()
Set conn2 = New ADODB.Connection
conn2.ConnectionString = strConn
conn2.CursorLocation = adUseClient
conn2.Open

finish = GetTickCount()
duration = finish - start
Debug.Print "Duration 2: " & Str(duration)
conn2.Close
Set conn2 = Nothing

I have two more connection objects in the code I have tested (omitted here to simplify).

Ok. Perfect. The problem is that I have tested it again in Visual C++ and does not work. If I set the OLE DB Services to -1 (or 0), then pooling is enabled, and if I set it to -2, then pooling is disabled. Do you know why does it work in different ways in Visual C++ and Visual Basic?

The code in Visual C++ looks like this. I use a wrapper class to encapsulate the ADODB::_ConnectionPtr object:

CADOConnection Conn;
CString strConn = _T("Provider=SQLOLEDB.1;Persist Security Info=False;Data Source=ALBERT;Initial Catalog=MyCatalog;User ID=arichart;Trusted_Connection=Yes;OLE DB Services = -2;");

Conn.SetConnectionString(strConn);

Conn.Connect();


The connect function looks like this:

bool CADOConnection::Connect()
{
ASSERT ( m_pADOConnection == NULL );
if ( m_pADOConnection != NULL )
Close(false);

#ifdef _DEBUG
clock_t start, finish;

start = clock();
#endif

HRESULT hr = S_OK;
try {
TESTHR(m_pADOConnection.CreateInstance(_T("ADODB.Connection")));
m_pADOConnection->ConnectionString = m_strConnectionString.AllocSysString();
m_pADOConnection->CursorLocation = ADODB::adUseClient;
TESTHR(m_pADOConnection->Open("", "", "",ADODB::adConnectUnspecified));
} catch ( _com_error &e ) {
CString strError = e.Description().copy();
AfxMessageBox(strError);

m_pADOConnection = NULL;

return false;
}

#ifdef _DEBUG
finish = clock();
double duration = (double)(finish - start) / CLOCKS_PER_SEC;
TRACE("ADO Connection opened. Duration: %2.3f seconds\n", duration );
#endif

return true;
}

I'm working on Windows 2000

I hope anybody could answer my question. Thanks in advance.

GeneralADO BeginTrans inside a try catch block Pin
John M. Drescher22-Oct-01 6:48
John M. Drescher22-Oct-01 6:48 
GeneralRe: ADO BeginTrans inside a try catch block Pin
Wanderley M22-Oct-01 23:11
Wanderley M22-Oct-01 23:11 
GeneralRe: ADO BeginTrans inside a try catch block Pin
John M. Drescher23-Oct-01 7:14
John M. Drescher23-Oct-01 7:14 
GeneralRe: ADO BeginTrans inside a try catch block Pin
Wanderley M23-Oct-01 11:50
Wanderley M23-Oct-01 11:50 
GeneralRe: ADO BeginTrans inside a try catch block Pin
John M. Drescher23-Oct-01 12:34
John M. Drescher23-Oct-01 12:34 
GeneralRe: ADO BeginTrans inside a try catch block Pin
Wanderley M23-Oct-01 22:45
Wanderley M23-Oct-01 22:45 
GeneralSQL Server 7.0 SP3 and money datatype Pin
Michael Martin21-Oct-01 20:46
professionalMichael Martin21-Oct-01 20:46 
GeneralRe: SQL Server 7.0 SP3 and money datatype Pin
Wanderley M22-Oct-01 3:32
Wanderley M22-Oct-01 3:32 
GeneralRe: SQL Server 7.0 SP3 and money datatype Pin
Michael Martin22-Oct-01 15:32
professionalMichael Martin22-Oct-01 15:32 
GeneralMSDE 2000 Question Pin
John M. Drescher21-Oct-01 8:57
John M. Drescher21-Oct-01 8:57 
GeneralRe: MSDE 2000 Question Pin
John M. Drescher22-Oct-01 5:48
John M. Drescher22-Oct-01 5:48 
GeneralADO DataGrid, MS Access & Server-side cursors Pin
Jim Stim18-Oct-01 22:53
Jim Stim18-Oct-01 22:53 
GeneralRe: ADO DataGrid, MS Access & Server-side cursors Pin
Rashid Thadha21-Oct-01 22:40
Rashid Thadha21-Oct-01 22:40 
QuestionHow to age out subscribers accounts? Pin
Jason Jystad18-Oct-01 9:37
Jason Jystad18-Oct-01 9:37 
AnswerRe: How to age out subscribers accounts? Pin
Wanderley M19-Oct-01 8:42
Wanderley M19-Oct-01 8:42 
GeneralRe: How to age out subscribers accounts? Pin
Jason Jystad22-Oct-01 7:15
Jason Jystad22-Oct-01 7:15 
GeneralRe: How to age out subscribers accounts? Pin
Wanderley M22-Oct-01 7:49
Wanderley M22-Oct-01 7:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.