Additional
dbCAP
AnyDAC
ThinDAC
NCOCI8
Topic: DAManager time out
DAManager time out
Posted: 2007/06/04 01:13
 
when dynamically switch between databases in same application allways the DAManager component exception is occured

Map:
1- Create New Defination
2- Connect to database
3- disconnect from this database
4- remove Defination
5- Create new one ->loop (2)

when application exit timeout Exception occured .
sometimes when switching also the timeout exception occured

All of this because there is no .chm or .hlp file integrated with CBuilder IDE or Delphi IDE.

Any one , Any Idea , etc ...

Regards.
Re:DAManager time out
Posted: 2007/06/04 02:51
 
Hello

You can consider to fill directly TADConnection properties.

Regards,
Dmitry
Re:DAManager time out
Posted: 2007/06/04 09:45
 
Thats not solution !!!!!!!!!
I try it ... see my last post
......................................
Re:DAManager time out
Posted: 2007/06/04 18:29
 
Hello

1) Once more - timeout will occur only if you have not closed connections.
2) Could you provide me your code ?

Regards,
Dmitry
Re:DAManager time out
Posted: 2007/06/05 07:50
 
void __fastcall Tdm::CreateConnectionDef(AnsiString dbhost,AnsiString dbname, AnsiString dbuser,AnsiString dbpass,AnsiString dbdriver)
{

dbConnection->DriverName=dbdriver;
TStringList* sl=new TStringList();
AnsiString tmp="Database=";
tmp+=dbname;
sl->Add(tmp);
tmp="User_Name=";
tmp+=dbuser;
sl->Add(tmp);
tmp="Password=";
tmp+=dbpass;
sl->Add(tmp);
tmp="Host=";
tmp+=dbhost;
sl->Add(tmp);
tmp="DriverID=";
tmp+=dbdriver;
sl->Add(tmp);
sl->Add("AutoCommit=False");
if(dbdriver=="MySQL")
sl->Add("CharacterSet=cp1256");
dbConnection->Params=sl;
/* if use this Time out
if(dbManager->IsConnectionDef("CurrentSQL"))
dbManager->DeleteConnectionDef("CurrentSQL");
dbManager->AddConnectionDef("CurrentSQl",dbdriver,sl);
*/
delete sl;
// if use this Time out
// dbConnection->ConnectionDefName="CurrentSQL";

}
void __fastcall Tdm:etDatabaseInfo(AnsiString dbhost,AnsiString dbname, AnsiString dbuser,AnsiString dbpass,AnsiString dbdriver)
{
dbHost=dbhost;
dbName=dbname;
dbUser=dbuser;
dbPass=dbpass;
dbDriver=dbdriver;
CreateConnectionDef(dbhost,dbname, dbuser,dbpass,dbdriver);
}
void __fastcall Tdm::Connect()
{
try
{
dbConnection->Open();
}
catch(...)
{
// Create New Database and Create Tables , StoredProcedures
database not found , create one
CreateDatabase();
}
}
void __fastcall Tdm:isconnect()
{
dbConnection->Close();
}
void __fastcall Tdm::CreateDatabase()
{
if(dbDriver=="MySQL")
CreateMySQLDatabase();
if(dbDriver=="Ora")
CreateOraDatabase();
}
void __fastcall Tdm::CreateMySQLDatabase()
{
CreateConnectionDef("localhost","mysql","root","","MySQL");
try
{
dbConnection->Open();
}
catch(...)
{
ShowMessage("Cant Create Database");
return;
}
createDatabase->SQL->Clear();
createDatabase->SQL->Add("create database "+dbName);
createDatabase->ExecSQL();
createDatabase->Close();
// Create Tables ... etc

Disconnect();
CreateConnectionDef(dbHost,dbName,dbUser,dbPass,dbDriver);
Connect();

}
void __fastcall Tdm::CreateOraDatabase()
{

}
void __fastcall Tdm::OnDestroy(TObject *Sender)
{
//
Disconnect();
}
//------------------------------------------------------------------
Re:DAManager time out
Posted: 2007/06/05 09:14
 
Hello

1) Please, do not multipost. Otherwise I will need to spend time to filter out dublicate posts.
2) Please, use Code tag (button above post text edit). Otherwise I will need to spend my time to format your code myself, to make it readable.
3) I will check your code.

Regards,
Dmitry