Kod: Tümünü seç
// MSSQLSERVER servisi çalışıyor mu
if cwinsrvc.ServiceStopped('','MSSQLSERVER') then begin
Application.MessageBox('SQL Server kurulu değil yada Servis Çalışmıyor....Program Sonlandırılacak.....','UYARI',MB_OK);
Halt;
end;

Kod: Tümünü seç
// MSSQLSERVER servisi çalışıyor mu
if cwinsrvc.ServiceStopped('','MSSQLSERVER') then begin
Application.MessageBox('SQL Server kurulu değil yada Servis Çalışmıyor....Program Sonlandırılacak.....','UYARI',MB_OK);
Halt;
end;
Kod: Tümünü seç
SQLService='MSSQLSERVER';
function GetServiceStatus(const ServiceName: string): SERVICE_STATUS;
const SQLHata='SQL Server';
var
SCM: SC_HANDLE;
ServiceHandle: SC_HANDLE;
begin
SCM := OpenSCManager(nil, nil, SC_MANAGER_ALL_ACCESS);
if SCM = 0 then
raise SQLException.CreateFmt('%s Yüklenmemiş',[SQLHata]);
ServiceHandle := OpenService(SCM, PChar(ServiceName), SERVICE_ALL_ACCESS);
if ServiceHandle = 0 then begin
CloseServiceHandle(SCM);
case GetLastError of
ERROR_ACCESS_DENIED: raise SQLException.CreateFmt('%s Yetersiz ayrıcalıklar',[SQLHata]);
ERROR_INVALID_HANDLE: raise SQLException.CreateFmt('%s Geçersiz Handle',[SQLHata]);
ERROR_INVALID_NAME:raise SQLException.CreateFmt('%s Servis Bulunamadı',[SQLHata]);
ERROR_SERVICE_DOES_NOT_EXIST: raise SQLException.CreateFmt('%s Servis bulunamadı',[SQLHata]);
end;
end;
//SeciliServis.ServiceStatus.dwCurrentState - SERVICE_STOPPED
if not QueryServiceStatus(ServiceHandle, Result) then
raise SQLException.Create('Durum Alınamadı');
end;
if GetServiceStatus(SQLService).dwCurrentState=SERVICE_RUNNING then ShowMessage(SQLService+' açık);
Kod: Tümünü seç
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server
içinde
InstalledInstances
değerini Memo1.Lines içine okut.
Kod: Tümünü seç
uses Registry;
procedure TForm1.Button1Click(Sender: TObject);
var
Info: TRegDataInfo;
Bilgi:PByteArray;
S:PChar;
begin
with TRegistry.Create do try
RootKey:=HKEY_LOCAL_MACHINE;
OpenKey('SOFTWARE\Microsoft\Microsoft SQL Server',False);
if GetDataInfo('InstalledInstances', Info) then try
Bilgi:=AllocMem(Info.DataSize);
ReadBinaryData('InstalledInstances',Bilgi^,Info.DataSize);
ListBox1.Items.Clear;
S:=@(Bilgi^);
repeat
ListBox1.Items.Add(S);
S:=Pointer(Integer(S)+Length(S)+1)
until (S='') or (S[1]=#0);
finally
FreeMem(Bilgi);
end;
finally
Free;
end;
end;
Kod: Tümünü seç
for i:=0 to ListBox1.Items.Count-1 do begin
if cwinsrvc.ServiceRunning('',ListBox1.Items.Strings[i]) then
break
else begin
Application.MessageBox('SQL Server kurulu değil yada Servis Çalışmıyor....Program Sonlandırılacak.....','UYARI',MB_OK);
Application.Terminate;
end;
end;
Kod: Tümünü seç
procedure TForm1.Button2Click(Sender: TObject);
var
Info: TRegDataInfo;
Bilgi:PByteArray;
S:PChar;
begin
with TRegistry.Create do try
RootKey:=HKEY_LOCAL_MACHINE;
OpenKey('SOFTWARE\Microsoft\Microsoft SQL Server',False);
if GetDataInfo('InstalledInstances', Info) then try
Bilgi:=AllocMem(Info.DataSize);
ReadBinaryData('InstalledInstances',Bilgi^,Info.DataSize);
ListBox1.Items.Clear;
S:=@(Bilgi^);
repeat
if S='MSSQLSERVER' then
ListBox1.Items.Add(S)
else begin
ListBox1.Items.Add('MSSQL$'+S);
end;
S:=Pointer(Integer(S)+Length(S)+1);
until (S='') or (S[1]=#0);
finally
FreeMem(Bilgi);
end;
finally
Free;
end;
end;
Kod: Tümünü seç
procedure TForm1.Button3Click(Sender: TObject);
var i:integer;
str:string;
tr:Boolean;
begin
tr:=false;
for i:=0 to ListBox1.Items.Count-1 do begin
str:=ListBox1.Items.Strings[i];
if cwinsrvc.ServiceRunning('',str) then begin
tr:=true;
break;
end;
end;
if tr=false then begin
Application.MessageBox('SQL Server kurulu değil yada Servis Çalışmıyor....Program Sonlandırılacak.....','UYARI',MB_OK);
Application.Terminate;
end;
end;
Kod: Tümünü seç
unit cwinsrvc;
interface
uses Windows, SysUtils, WinSvc;
function ServiceGetStrCode(nID : integer) : string;
function ServiceGetStatus(sMachine,sService : string) : DWord;
function ServiceRunning(sMachine,sService : string) : boolean;
function ServiceStopped(sMachine,sService : string) : boolean;
function ServiceStart(sMachine,sService : string) : boolean;
function ServiceStop(sMachine,sService : string) : boolean;
implementation
// convert status codes returned by
// ServiceGetStatus() to string values
function ServiceGetStrCode(nID : integer) : string;
var
s : string;
begin
case nID of
SERVICE_STOPPED : s := 'STOPPED';
SERVICE_RUNNING : s := 'RUNNING';
SERVICE_PAUSED : s := 'PAUSED';
SERVICE_START_PENDING : s := 'START/PENDING';
SERVICE_STOP_PENDING : s := 'STOP/PENDING';
SERVICE_CONTINUE_PENDING : s := 'CONTINUE/PENDING';
SERVICE_PAUSE_PENDING : s := 'PAUSE/PENDING';
else
s := 'UNKNOWN';
end;
Result := s;
end;
// return status code if successful, -1 if not
// return codes:
// SERVICE_STOPPED
// SERVICE_RUNNING
// SERVICE_PAUSED
// following return codes are used to indicate that the // service is in the middle of getting to one
// of the above states:
// SERVICE_START_PENDING
// SERVICE_STOP_PENDING
// SERVICE_CONTINUE_PENDING
// SERVICE_PAUSE_PENDING
// sMachine:
// machine name, ie: \\SERVER
// empty = local machine
// sService
// service name, ie: Alerter
function ServiceGetStatus(sMachine,sService : string) : DWord;
var
schm : SC_Handle; //service control manager handle
schs : SC_Handle; // service handle
ss : TServiceStatus; // service status
dwStat : DWord; // current service status
begin
dwStat := 1;
// connect to the service control manager
schm := OpenSCManager( PChar(sMachine), Nil,
SC_MANAGER_CONNECT);
// if successful...
if(schm > 0)then
begin
// open a handle to the specified service
// we want to query service status
schs := OpenService( schm, PChar(sService),
SERVICE_QUERY_STATUS);
// if successful...
if(schs > 0)then
begin
// retrieve the current status
//of the specified service
if (QueryServiceStatus( schs, ss)) then
begin
dwStat := ss.dwCurrentState;
end;
// close service handle
CloseServiceHandle(schs);
end;
// close service control manager handle
CloseServiceHandle(schm);
end;
Result := dwStat;
end;
// Return TRUE if the specified service is running,
// defined by the status code SERVICE_RUNNING. Return
// FALSE if the service is in any other state,
// including any pending states
function ServiceRunning(sMachine,sService : string) : boolean;
begin
Result := SERVICE_RUNNING =
ServiceGetStatus(sMachine, sService);
end;
// Return TRUE if the specified service was stopped,
// defined by the status code SERVICE_STOPPED.
function ServiceStopped(sMachine,sService : string) : boolean;
begin
Result := SERVICE_STOPPED =
ServiceGetStatus(sMachine, sService);
end;
// Return TRUE if successful
function ServiceStart(sMachine,sService : string) : boolean;
var
schm,
schs : SC_Handle;
ss : TServiceStatus;
psTemp : PChar;
dwChkP : DWord; // check point
begin
ss.dwCurrentState := 1;
// connect to the service control manager
schm := OpenSCManager(PChar(sMachine), nil,
SC_MANAGER_CONNECT);
// if successful...
if(schm > 0)then
begin
// open a handle to the specified service
// we want to start the service and query service
// status
schs := OpenService(schm, PChar(sService),
SERVICE_START or SERVICE_QUERY_STATUS);
// if successful...
if(schs > 0)then
begin
psTemp := Nil;
if(StartService( schs, 0,psTemp))then
begin
// check status
if(QueryServiceStatus(schs, ss))then
begin
while(SERVICE_RUNNING <> ss.dwCurrentState)do
begin
// dwCheckPoint contains a value that the
// service increments periodically to
// report its progress during a
// lengthy operation. Save current value
dwChkP := ss.dwCheckPoint;
// wait a bit before checking status again
// dwWaitHint is the estimated amount of
// time the calling program should wait
// before calling QueryServiceStatus()
// again. Idle events should be
// handled here...
Sleep(ss.dwWaitHint);
if not QueryServiceStatus(schs, ss) then
begin
// couldn't check status break from the
// loop
break;
end;
if ss.dwCheckPoint < dwChkP then
begin
// QueryServiceStatus didn't increment
// dwCheckPoint as it should have.
// Avoid an infinite loop by breaking
break;
end;
end;
end;
end;
// close service handle
CloseServiceHandle(schs);
end;
// close service control manager handle
CloseServiceHandle(schm);
end;
// Return TRUE if the service status is running
Result := SERVICE_RUNNING = ss.dwCurrentState;
end;
// Return TRUE if successful
function ServiceStop(sMachine,sService : string) : boolean;
var
schm,
schs : SC_Handle;
ss : TServiceStatus;
dwChkP : DWord;
begin
// connect to the service control manager
schm := OpenSCManager(PChar(sMachine), nil,
SC_MANAGER_CONNECT);
// if successful...
if schm > 0 then
begin
// open a handle to the specified service
// we want to stop the service and
// query service status
schs := OpenService( schm, PChar(sService),
SERVICE_STOP or SERVICE_QUERY_STATUS);
// if successful...
if schs > 0 then
begin
if ControlService(schs, SERVICE_CONTROL_STOP,
ss) then
begin
// check status
if(QueryServiceStatus(schs, ss))then
begin
while(SERVICE_STOPPED <> ss.dwCurrentState)do
begin
// dwCheckPoint contains a value that the
// service increments periodically to
// report its progress during a lengthy
// operation. Save current value
dwChkP := ss.dwCheckPoint;
// Wait a bit before checking status again.
// dwWaitHint is the estimated amount of
// time the calling program should wait
// before calling QueryServiceStatus()
// again. Idle events should be
// handled here...
Sleep(ss.dwWaitHint);
if(not QueryServiceStatus(schs,ss))then
begin
// couldn't check status
// break from the loop
break;
end;
if(ss.dwCheckPoint <
dwChkP)then
begin
// QueryServiceStatus didn't increment
// dwCheckPoint as it should have.
// Avoid an infinite loop by breaking
break;
end;
end;
end;
end;
// close service handle
CloseServiceHandle(schs);
end;
// close service control manager handle
CloseServiceHandle(schm);
end;
// return TRUE if the service status is stopped
Result := SERVICE_STOPPED = ss.dwCurrentState;
end;
end.
Kod: Tümünü seç
unit Services;
interface
uses
classes, // TStrings
windows, //DWORD
WinSvc, // TEnumServiceStatus
SysUtils; //StrPas
const
cnMaxServices = 4096;
SERVICE_KERNEL_DRIVER = $00000001;
SERVICE_FILE_SYSTEM_DRIVER = $00000002;
SERVICE_ADAPTER = $00000004;
SERVICE_RECOGNIZER_DRIVER = $00000008;
SERVICE_DRIVER = (SERVICE_KERNEL_DRIVER or SERVICE_FILE_SYSTEM_DRIVER or SERVICE_RECOGNIZER_DRIVER);
SERVICE_WIN32_OWN_PROCESS = $00000010;
SERVICE_WIN32_SHARE_PROCESS = $00000020;
SERVICE_WIN32 = (SERVICE_WIN32_OWN_PROCESS or SERVICE_WIN32_SHARE_PROCESS);
SERVICE_INTERACTIVE_PROCESS = $00000100;
SERVICE_TYPE_ALL = (SERVICE_WIN32 or SERVICE_ADAPTER or SERVICE_DRIVER or SERVICE_INTERACTIVE_PROCESS);
type
TSvcA = array[0..cnMaxServices] of TEnumServiceStatus;
PSvcA = ^TSvcA;
function ServiceGetList(slServicesList: TStrings; sMachine: string = ''; dwServiceType: DWORD = SERVICE_WIN32; dwServiceState: DWord = SERVICE_STATE_ALL): Boolean;
//-------------------------------------
// Gets a list of services
//
// return TRUE if successful
//
// sMachine:
// machine name, ie: \\SERVER
// empty = local machine
//
// dwServiceType
// SERVICE_WIN32,
// SERVICE_DRIVER or
// SERVICE_TYPE_ALL
//
// dwServiceState
// SERVICE_ACTIVE,
// SERVICE_INACTIVE or
// SERVICE_STATE_ALL
//
// slServicesList
// TStrings variable to storage
//
//-------------------------------------
function ServiceGetStatus(sMachine, sService: string): Integer;
//-------------------------------------
// get service status
//
// return status code if successful
// -1 if not
//
// return codes:
// SERVICE_STOPPED
// SERVICE_RUNNING
// SERVICE_PAUSED
//
// following return codes
// are used to indicate that
// the service is in the
// middle of getting to one
// of the above states:
// SERVICE_START_PENDING
// SERVICE_STOP_PENDING
// SERVICE_CONTINUE_PENDING
// SERVICE_PAUSE_PENDING
//
// sMachine:
// machine name, ie: \\SERVER
// empty = local machine
//
// sService
// service name, ie: Alerter
//-------------------------------------
function ServiceRunning(sMachine, sService: string): Boolean;
//-------------------------------------
// return TRUE if the specified
// service is running, defined by
// the status code SERVICE_RUNNING.
// return FALSE if the service
// is in any other state, including
// any pending states
//-------------------------------------
function ServiceStart(sMachine, sService: string): Boolean;
//-------------------------------------
// start service
//
// return TRUE if successful
//
// sMachine:
// machine name, ie: \\SERVER
// empty = local machine
//
// sService
// service name, ie: Alerter
//-------------------------------------
function ServiceStop(sMachine, sService: string): Boolean;
//-------------------------------------
// stop service
//
// return TRUE if successful
//
// sMachine:
// machine name, ie: \\SERVER
// empty = local machine
//
// sService
// service name, ie: Alerter
//-------------------------------------
function ServiceStopped(sMachine, sService: string): Boolean;
//-------------------------------------
// return TRUE if the specified
// service was stopped, defined by
// the status code SERVICE_STOPPED.
//-------------------------------------
implementation
function ServiceGetList(slServicesList: TStrings; sMachine: string = ''; dwServiceType: DWORD = SERVICE_WIN32; dwServiceState: DWord = SERVICE_STATE_ALL): Boolean;
var
j: Integer;
schm: SC_Handle;
ssa: PSvcA;
nBytesNeeded, nServices, nResumeHandle: DWord;
begin
Result := False;
schm := OpenSCManager(pChar(sMachine), nil, SC_MANAGER_ALL_ACCESS); // connect to the service control manager
if (schm > 0) then // if successful...
begin
nResumeHandle := 0;
New(ssa);
EnumServicesStatus(schm, dwServiceType, dwServiceState, ssa^[0], SizeOf(ssa^), nBytesNeeded, nServices, nResumeHandle);
// Assume that our initial array was large enough to hold all entries. add code to enumerate if necessary.
for j := 0 to nServices - 1 do
slServicesList.Add(StrPas(ssa^[j].lpDisplayName));
Result := True;
Dispose(ssa);
CloseServiceHandle(schm); // close service control manager handle
end;
end;
function ServiceGetStatus(sMachine, sService: string): Integer;
var
schm,
schs: SC_Handle;
ss: TServiceStatus;
dwStat: Integer;
begin
dwStat := -1;
schm := OpenSCManager(pChar(sMachine), nil, SC_MANAGER_CONNECT);
if (schm > 0) then // if successful...
begin
schs := OpenService(schm, pChar(sService), SERVICE_QUERY_STATUS);
if (schs > 0) then // if successful...
if (QueryServiceStatus(schs, ss)) then
dwStat := ss.dwCurrentState;
CloseServiceHandle(schs);
CloseServiceHandle(schm);
end;
Result := dwStat;
end;
function ServiceRunning(sMachine, sService: string): Boolean;
begin
Result := SERVICE_RUNNING = ServiceGetStatus(sMachine, sService);
end;
function ServiceStopped(sMachine, sService: string): Boolean;
begin
Result := SERVICE_STOPPED = ServiceGetStatus(sMachine, sService);
end;
function ServiceStart(sMachine, sService: string): Boolean;
var
schm, schs: SC_Handle;
ss: TServiceStatus;
psTemp: pChar;
dwChkP: DWord;
begin
ss.dwCurrentState := 0;
schm := OpenSCManager(pChar(sMachine), nil, SC_MANAGER_CONNECT);
if (schm > 0) then // if successful...
begin
schs := OpenService(schm, pChar(sService), SERVICE_START or SERVICE_QUERY_STATUS);
if (schs > 0) then // if successful...
begin
psTemp := nil;
if (StartService(schs, 0, psTemp)) then
begin
if (QueryServiceStatus(schs, ss)) then
begin
while (SERVICE_RUNNING <> ss.dwCurrentState) do
begin
dwChkP := ss.dwCheckPoint;
SleepEx(ss.dwWaitHint, False);
if (not QueryServiceStatus(schs, ss)) then
break;
if (ss.dwCheckPoint < dwChkP) then
break;
end;
end;
end;
CloseServiceHandle(schs);
end;
CloseServiceHandle(schm);
end;
Result := SERVICE_RUNNING = ss.dwCurrentState;
end;
function ServiceStop(sMachine, sService: string): Boolean;
var
schm, schs: SC_Handle;
ss: TServiceStatus;
dwChkP: DWord;
begin
schm := OpenSCManager(pChar(sMachine), nil, SC_MANAGER_CONNECT);
if (schm > 0) then // if successful...
begin
schs := OpenService(schm, pChar(sService), SERVICE_STOP or SERVICE_QUERY_STATUS);
if (schs > 0) then // if successful...
begin
if (ControlService(schs, SERVICE_CONTROL_STOP, ss)) then
begin
if (QueryServiceStatus(schs, ss)) then
begin
while (SERVICE_STOPPED <> ss.dwCurrentState) do
begin
dwChkP := ss.dwCheckPoint;
SleepEx(ss.dwWaitHint, False);
if (not QueryServiceStatus(schs, ss)) then
break;
if (ss.dwCheckPoint < dwChkP) then
break;
end;
end;
end;
CloseServiceHandle(schs);
end;
CloseServiceHandle(schm);
end;
Result := SERVICE_STOPPED = ss.dwCurrentState;
end;
end.
Kod: Tümünü seç
//servisi çalıştır
procedure TForm1.Button8Click(Sender: TObject);
begin
ServiceStart('','MSSQLSERVER');
end;
Kod: Tümünü seç
//servisi durdur
procedure TForm1.Button4Click(Sender: TObject);
begin
ServiceStop('','MSSQLSERVER');
end;
Kod: Tümünü seç
//servsisn çalışıp çalışmadığını kontrol et
procedure TForm1.Button9Click(Sender: TObject);
begin
if ServiceRunning('\\IBRAHIM','MSSQLSERVER') then
next
else
Application.Terminate;
end;
Kod: Tümünü seç
uses Registry;
procedure TForm1.Button1Click(Sender: TObject);
var
Info: TRegDataInfo;
Bilgi:PByteArray;
S:PChar;
begin
with TRegistry.Create do try
RootKey:=HKEY_LOCAL_MACHINE;
OpenKey('SOFTWARE\Microsoft\Microsoft SQL Server',False);
if GetDataInfo('InstalledInstances', Info) then try
Bilgi:=AllocMem(Info.DataSize);
ReadBinaryData('InstalledInstances',Bilgi^,Info.DataSize);
ListBox1.Items.Clear;
S:=@(Bilgi^);
repeat
//if Trim(S)='' then Break ya da
if Trim(S)<>'' then //satırını kullan
ListBox1.Items.Add(S);
S:=Pointer(Integer(S)+Length(S)+1)
until (S='') or (S[1]=#0);
finally
FreeMem(Bilgi);
end;
finally
Free;
end;
end;
Kod: Tümünü seç
//instance adları
procedure TForm1.Button2Click(Sender: TObject);
var
Info: TRegDataInfo;
Bilgi:PByteArray;
S:PChar;
begin
with TRegistry.Create do try
RootKey:=HKEY_LOCAL_MACHINE;
OpenKey('SOFTWARE\Microsoft\Microsoft SQL Server',False);
if GetDataInfo('InstalledInstances', Info) then try
Bilgi:=AllocMem(Info.DataSize);
ReadBinaryData('InstalledInstances',Bilgi^,Info.DataSize);
ListBox1.Items.Clear;
S:=@(Bilgi^);
repeat
if Trim(S)='' then Break;
ListBox1.Items.Add(S);
S:=Pointer(Integer(S)+Length(S)+1)
until (S='') or (S[1]=#0);
finally
FreeMem(Bilgi);
end;
finally
Free;
end;
end;
Kod: Tümünü seç
//Sql server servis adları
procedure TForm1.Button3Click(Sender: TObject);
var
Info: TRegDataInfo;
Bilgi:PByteArray;
S:PChar;
begin
with TRegistry.Create do try
RootKey:=HKEY_LOCAL_MACHINE;
OpenKey('SOFTWARE\Microsoft\Microsoft SQL Server',False);
if GetDataInfo('InstalledInstances', Info) then try
Bilgi:=AllocMem(Info.DataSize);
ReadBinaryData('InstalledInstances',Bilgi^,Info.DataSize);
ListBox1.Items.Clear;
S:=@(Bilgi^);
repeat
if Trim(S)='' then Break;
if S='MSSQLSERVER' then
ListBox1.Items.Add(S)
else
ListBox1.Items.Add('MSSQL$'+S);
S:=Pointer(Integer(S)+Length(S)+1)
until (S='') or (S[1]=#0);
finally
FreeMem(Bilgi);
end;
finally
Free;
end;
end;
Kod: Tümünü seç
ADOConnection1.Connected:=False;
ADOConnection1.ConnectionString:='Provider=SQLOLEDB.1;Persist Security Info=false;User ID=sa;Initial Catalog=master;Password ='+trim(Edit3.Text)+';Data Source=' +trim(Edit1.Text);
ADOConnection1.Connected:=True;
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('select * from master..sysdatabases WHERE name = ''DATA1'' ');
ADOQuery1.Open;
if ADOQuery1.RecordCount > 0 then begin
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Text:='EXEC sp_detach_db ''DATA1'', ''false'' ';
ADOQuery1.ExecSQL;
//ADOQuery1.Close;
//ADOQuery1.SQL.Text := 'USE master IF EXISTS(SELECT * FROM master..sysdatabases where name = ''DATA1'') drop data_base ''DATA1''';
//ADOQuery1.ExecSQL;
end;
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('select * from master..sysdatabases WHERE name = ''DATA1'' ');
ADOQuery1.Open;
if ADOQuery1.RecordCount = 0 then begin
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Text:='EXEC sp_attach_db @dbname = N''DATA1'',@filename1 =N'''+str_data+''',@filename2 = N'''+str_log+''' ';
ADOQuery1.ExecSQL;
end;
Kod: Tümünü seç
Provider=SQLNCLI.1;
Integrated Security=SSPI;
Persist Security Info=False;
Initial Catalog=HSH;
Data Source=NAME\SQLEXPRESS;
Use Procedure for Prepare=1;
Auto Translate=True;
Packet Size=4096;
Workstation ID=NAME;
Use Encryption for Data=False;
Tag with column collation when possible=False;
MARS Connection=True;
DataTypeCompatibility=0