SQL Server and thread
Posted: Wed 20 May 2015 14:40
Hi, I'm testing unidac with sql server to buy it.
I created a thread.
The Execute function is that:
void __fastcall UpdateThread::Execute()
{
SetName();
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
_uniConnection = new TUniConnection(NULL);
_uniConnection->ProviderName = "SQL Server";
_uniConnection->Database = "RaceManagerDevelopment";
_uniConnection->SpecificOptions->Add("SQL Server.Authentication=auWindows");
_uniConnection->Pooling = true;
_uniConnection->Server = "NB-ALESSANDROM\SQLEXPRESS";
_uniConnection->LoginPrompt = false;
_uniConnection->Connected = true;
CoUninitialize();
}
//---------------------------------------------------------------------------
The thread freezes when execute Connected = true.
It happens also if I pass a working connection to the thread (anotherConnection comes form main thread and works fine)
_uniConnection = new TUniConnection(*anotherConnection);
_uniConnection->Connected = true;
Please let me know what is wrong
Regards
I created a thread.
The Execute function is that:
void __fastcall UpdateThread::Execute()
{
SetName();
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
_uniConnection = new TUniConnection(NULL);
_uniConnection->ProviderName = "SQL Server";
_uniConnection->Database = "RaceManagerDevelopment";
_uniConnection->SpecificOptions->Add("SQL Server.Authentication=auWindows");
_uniConnection->Pooling = true;
_uniConnection->Server = "NB-ALESSANDROM\SQLEXPRESS";
_uniConnection->LoginPrompt = false;
_uniConnection->Connected = true;
CoUninitialize();
}
//---------------------------------------------------------------------------
The thread freezes when execute Connected = true.
It happens also if I pass a working connection to the thread (anotherConnection comes form main thread and works fine)
_uniConnection = new TUniConnection(*anotherConnection);
_uniConnection->Connected = true;
Please let me know what is wrong
Regards