How to connect to an online MSSQL 2005 database
Posted: Fri 26 Nov 2010 18:57
I'm trying to connect to an online MSSQL database without any succes. On connecting the firewall is not throwing a question to connect. It seems the connection is not trying to connect to the internet.
I'm using C++ Builder XE, dbExpress (XE package), MSSQL Server 2005. MS SQL Server Management Studio can connect without any problems.
The error message after a 30 seconds is: Project Project1.exe raised exception class TDBXError with message 'SQL State: HYT00, SQL Error Code: 0 Login timeout expired. SQL State: 08001 SQL Error Code: 3. A netword-related or instance-specific error has occured while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance'.
The following parameters are set:
The code for connection is:
I tried adding 'http://' to the 'HostName' parameter without any succes. Can someone please explain me how to connect to an online MSSQL database? Thank you in advance for your help.
I'm using C++ Builder XE, dbExpress (XE package), MSSQL Server 2005. MS SQL Server Management Studio can connect without any problems.
The error message after a 30 seconds is: Project Project1.exe raised exception class TDBXError with message 'SQL State: HYT00, SQL Error Code: 0 Login timeout expired. SQL State: 08001 SQL Error Code: 3. A netword-related or instance-specific error has occured while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance'.
The following parameters are set:
Code: Select all
SQLConnection1->ConnectionName = "MSSQLConnection";
SQLConnection1->DriverName = "MSSQL";
SQLConnection1->GetDriverFunc = "getSQLDriverMSSQL";
SQLConnection1->LibraryName = "dbxmss.dll";
SQLConnection1->VendorLib = "sqlncli10.dll";
SQLConnection1->LoadParamsOnConnect = true;
SQLConnection1->Params->Clear();
SQLConnection1->Params->Add("HostName=domain.net");
SQLConnection1->Params->Add("Database=***");
SQLConnection1->Params->Add("User_Name=***");
SQLConnection1->Params->Add("Password=***");
SQLConnection1->Params->Add("Port=1433");
SQLConnection1->Params->Add("BlobSize=-1");
SQLConnection1->Params->Add("ErrorResourceFile=");
SQLConnection1->Params->Add("LocaleCode=0000");
SQLConnection1->LoginPrompt = false;
Code: Select all
SimpleDataSet1->DataSet->CommandText = "SELECT * FROM pages";
SimpleDataSet1->Active = true;
SQLConnection1->Open();