You are not logged in.
Pages: 1
when I use Unidac Connect to SQL Server
  fConnection := TSQLDBUniDACConnectionProperties.Create(
  TSQLDBUniDACConnectionProperties.URI(TSQLDBDefinition.dMSSQL,
  '127.0.0.1;Port=8829;Database=Nuoxin'),'Nuoxin', 'sa', 'dev');
I got some error Can't not open SQL Server
constructor TSQLDBUniDACConnection.Create(aProperties: TSQLDBConnectionProperties);
var options: TStrings;
    PortNumber, i: Integer;
begin
  inherited Create(aProperties);
  fDatabase := TUniConnection.Create(nil);
  fDatabase.ProviderName := UTF8ToString(fProperties.ServerName);
  case aProperties.DBMS of
  dSQLite, dFirebird, dPostgreSQL, dMySQL, dDB2:
    fDatabase.Database := UTF8ToString(fProperties.DatabaseName);
  else
    fDatabase.Server := UTF8ToString(fProperties.DatabaseName);
  end;
  options := (fProperties as TSQLDBUniDACConnectionProperties).fSpecificOptions;
  if fDatabase.Server='' then // see TSQLDBUniDACConnectionProperties.URI()
    fDatabase.Server := options.Values['Server'];
  if fDatabase.Database='' then
    fDatabase.Database := options.Values['Database'];
  if (fDatabase.Port=0) and TryStrToInt(options.Values['Port'],PortNumber) then
    fDatabase.Port := PortNumber;
  fDatabase.Username := UTF8ToString(fProperties.UserID);
  fDatabase.Password := UTF8ToString(fProperties.PassWord);
  for i := 0 to options.Count-1 do
    if FindRawUTF8(['Server','Database','Port'],
        StringToUTF8(options.Names[i]),false)<0 then
      fDatabase.SpecificOptions.Add(options[i]);
end;
case aProperties.DBMS of
  dSQLite, dFirebird, dPostgreSQL, dMySQL, dDB2:
    fDatabase.Database := UTF8ToString(fProperties.DatabaseName);
  else
    fDatabase.Server := UTF8ToString(fProperties.DatabaseName);
  end;Fixed:
case aProperties.DBMS of
   dSQLite, dFirebird, dPostgreSQL, dMySQL, dDB2:
      fDatabase.Database := UTF8ToString(fProperties.DatabaseName);
  end;
Now It work
Offline
What is the error?
Why not set the database name as parameter only, and not in the connection string.
We do not have issues in PerfTest.dpr to connect to MSSQL via UniDAC using:
    Test(TSQLDBUniDACConnectionProperties,UNIDAC_PROVIDER[dMSSQL],
      '(localdb)\v11.0','','',' MSSQL2012',false);
    Test(TSQLDBUniDACConnectionProperties,UNIDAC_PROVIDER[dMSSQL],
      '.\SQLExpress','','',' MSSQL2008',false);Offline
@ab
Thank for reply. I think is the URI what i enter.
How to solve unicode chartset
Env: 
 Database:   SQL Server 2000
 DBAccss: Unidac, Zeoslib
    DBStatement := FConnection.NewConnection.NewStatement;
     DBStatement.Prepare('SELECT F_ID,F_CODE,F_NAME FROM TB_PRODUCT_ATTRIBUTE', true);
     DBStatement.ExecutePreparedAndFetchAllAsJSON(true,ResultJson);
     Memo1.Lines.Add(ResultJson);Result
[{"F_ID":975617,"F_CODE":"0018","F_NAME":"P639触摸å±"},{"F_ID":975618,"F_CODE":"0019","F_NAME":"高科GK757"},{"F_ID":975619,"F_CODE":"0020","F_NAME":"和信C001"},{"F_ID":975620,"F_CODE":"0021","F_NAME":"金é¹S1618"},{"F_ID":975621,"F_CODE":"0022","F_NAME":"è”通充值å¡100"},{"F_ID":975622,"F_CODE":"0023","F_NAME":"è”通充值å¡1500"},{"F_ID":975623,"F_CODE":"0024","F_NAME":"è”æƒ³MA166T"},{"F_ID":975624,"F_CODE":"0025","F_NAME":"TD IMX135 FUJIFILM MODULE"},{"F_ID":975625,"F_CODE":"0026","F_NAME":"天è¯A905(电信)"},{"F_ID":975626,"F_CODE":"0027","F_NAME":"天è¯A906(电信)"},{"F_ID":975627,"F_CODE":"0028","F_NAME":"天è¯D780(电信)"},{"F_ID":975628,"F_CODE":"0029","F_NAME":"天è¯D788(电信)"},{"F_ID":975629,"F_CODE":"0030","F_NAME":"亿和æºL4000"},{"F_ID":975630,"F_CODE":"0031","F_NAME":"英åŽè¾¾A110(电信)"},{"F_ID":975631,"F_CODE":"0032","F_NAME":"英åŽè¾¾C150"},{"F_ID":978213,"F_CODE":"0040","F_NAME":"è¯è´¹å……值"},{"F_ID":979557,"F_CODE":"0042","F_NAME":"å“牌分类 3333"}]Test Data
 CREATE TABLE TB_EMPLOYEE
( F_ID BIGINT PRIMARY KEY,
  F_CODE VARCHAR(32),
  F_NAME VARCHAR(64]
)
 INSERT INTO TB_EMPLOYEE(F_ID,F_CODE,F_NAME) SELECT 1, '00', '测试‘) union all  SELECT  2, '01', '测试1‘)  SELECT 2, '02', '测试3‘)
 Offline
I GOT ..Utf8 thanks. it's very simple , i like it
Offline
Pages: 1