Watch, Follow, &
Connect with Us

Please visit our new home
community.embarcadero.com.


Welcome, Guest
Guest Settings
Help

Thread: Can Not Connect with Microsoft SQLExpress on Some machines.


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 1 - Last Post: Sep 7, 2016 12:31 AM Last Post By: Bernd Maierhofer Threads: [ Previous | Next ]
Donald Bossen

Posts: 81
Registered: 2/3/02
Can Not Connect with Microsoft SQLExpress on Some machines.  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 6, 2016 1:24 PM
I can connect through my program on 2 different PC's to a third I call the SubServer It contains the Sql Data Base's but when I try a third machine I get a can Not Connect. This happens at different location as well these have their own SubServer Installed with a duplicate data base. Here is My Code.
function TFrmTb2.ConnectToSqlDB(Var DataBase : TADOConnection; Catalog : String; Var Msg : ShortString) : Boolean;
var
cntStr : String;
begin
msg := '';
CntStr := DataBase.Name;
if not DataBase.Connected then
begin
if Not DataBase.Connected then
begin
with FrmTb2 do
begin //Edit ConfigHdwe2016Nw.Ini in tne Score2016NW Directory section SQL
CntStr := 'Provider='+ReadIniStr(IniHdwe,'SQL','Provider')+';';//SQLNCLI11.1';//SQLNCLI10.1;';
CntStr := CntStr + 'Integrated Security='+ReadIniStr(IniHdwe,'SQL','Integrated Security')+';';//"";';
CntStr := CntStr + 'Persist Security Info='+ReadIniStr(IniHdwe,'SQL','Persist Security Info')+';';//False;';
CntStr := CntStr + 'User ID='+ReadIniStr(IniHdwe,'SQL','User ID')+';';//shithead;';
CntStr := CntStr + 'password='+ReadIniStr(IniHdwe,'SQL','password')+';';//shithead;';
CntStr := CntStr + 'OLE DB Services='+ReadIniStr(IniHdwe,'SQL','OLE DB Services')+';';// -2;';
CntStr := CntStr + 'Initial Catalog='+Catalog+';';
CntStr := CntStr + 'Data Source='+ReadIniStr(IniHdwe,'SQL','Data Source')+';';//\SQLEXPRESS;';
CntStr := CntStr + 'Initial File Name='+ReadIniStr(IniHdwe,'SQL','Initial File Name')+';';//"";';
CntStr := CntStr + 'Packet Size='+ReadIniStr(IniHdwe,'SQL','Packet Size')+';';//4096;';
CntStr := CntStr + 'Auto Translate='+ReadIniStr(IniHdwe,'SQL','Auto Translate')+';';//True;';
CntStr := CntStr + 'Server SPN='+ReadIniStr(IniHdwe,'SQL','Server SPN')+';';//""';
end;
// ShowMessage(CntStr);
DataBase.ConnectionString := CntStr;
try
DataBase.Connected := True;
if DataBase.Connected then
begin
// ShowMessage('After Conection');
result := True;
end
else
begin
result := False;
ShowMessage('Unable to Connect to Score2016Nw Database Bad Ip or Connection Missing1');
end;
except
result := False;
ShowMessage('Unable to Connect to Score2016Nw Database Bad Ip or Connection Missing2');
end;
end
else
result := True;
end
else
result := True; // we are still conected to the sql database
end;
And Here is the Ini file.

[SQL]
Provider=SQLNCLI11
Integrated Security=""""
Persist Security Info=False
User ID=JJJ\SCORES
Password=Chowder9
OLE DB Services = -2
Data Source=sub_co\SQLEXPRESS
Initial File Name=""""
Packet Size=4096
Auto Translate=True
Server SPN=""""

This is copied from machine to machine and as I said works on 2 but not the third. I can on this third machine create a ODBC connection to the subserver. Why will it not read through the network?
Bernd Maierhofer

Posts: 161
Registered: 9/27/99
Re: Can Not Connect with Microsoft SQLExpress on Some machines.  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 7, 2016 12:31 AM   in response to: Donald Bossen in response to: Donald Bossen
For the Express editions listening to the network is not enabled, so
only local connections suceed. Go to services/SQL Server
services/Configuration and turn on TCPIP protocol or whatever fits for
you.

Maybe the listening ports of MSSQL Server are closed by the firewall or
set to non defaults?

Maybe the user/account has not enough rights to connect to the SQL
server via the network?

greets Bernd

Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02