SDAC and localDB

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
hellowangyi
Posts: 4
Joined: Fri 15 Jan 2010 08:38

SDAC and localDB

Post by hellowangyi » Mon 16 Jun 2014 02:39

I am using Delphi XE2,SDAC6.9.18,win7 prof.
On Computer A , I have installed SQL Server Express 2012 include localDB,and create a database 'test' with SSMS under "(localdb)\v11.0", my program can connect database "test" .

Now I try to deploy the application to computer B . On computer B , I installed localDB(SQLLocalDB.msi),native client(sqlncli.msi),and the .Net is 4.5.1.
And the two database's files(test.mdf and test_log.ldf) on computer B were copied from computer A.

The properties of TMSConnection are:

Code: Select all

        con1.Authentication := auWindows;
        con1.ConnectionTimeout := 0;
        con1.Server :=(localdb)\v11.0
        con1.DataBase := 'test';
        con1.Options.Provider := prNativeClient;
        con1.Options.NativeClientVersion := nc2012;
        con1.Options.InitialFileName := 'd:\data\test.mdf';
       
when set con1.connected=true, can not connect to the database. the error message is
"login failed for user 'AB-PC\AB'.
Cannot open database "test" requested by the login. The login failed. "

where is the error?

Thanks in advance.

PS:Computer B is a clean computer only have Win7(32bit)sp1,SQL Server 2012 localDB(SQLLocalDB.msi),native client(sqlncli.msi) for SQL Server 2012,and the .Net is 4.5.1.

WY

azyk
Devart Team
Posts: 1057
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: SDAC and localDB

Post by azyk » Wed 18 Jun 2014 13:09

This error is generated by localDB. To access the "test" database on the computer B, it must be attached to the localDB. This can be read at msdn: http://blogs.msdn.com/b/bethmassi/archi ... qlcmd.aspx

hellowangyi
Posts: 4
Joined: Fri 15 Jan 2010 08:38

Re: SDAC and localDB

Post by hellowangyi » Wed 18 Jun 2014 14:05

azyk thank you very much.
I tried your method,it solved my problem.

thank you again.

WY.

azyk
Devart Team
Posts: 1057
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: SDAC and localDB

Post by azyk » Fri 20 Jun 2014 10:36

Feel free to contact us if you have any further questions.

Post Reply