5

I am currently logged to a users machine on Active Directory Domain A, and I need to access a Database in MSSQL 2000 located in Domain B via VB6. The user has accounts in both Active Directory Servers. The Active Directory Domains are not related or linked.

At the moment i`m using the following MSSQL connection string:

gcnnBD.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=" & gsDataBase & ";Data Source=" & gsServidor & ";Connect Timeout=" & gsTimeOutconnection string.

Is it possible to connect to Domain B via the connection string, if im logged in to Domain A?

What would the connection string look like?

Any suggestions are welcome.

Benjamin Ortuzar
  • 7,801
  • 6
  • 41
  • 46

3 Answers3

2

Yes, but since you're using integrated authentication, Domain B will need to trust Domain A. If you're infamiliar with this term, your domain admins should be able to help. You will probably need to qualify the server name too, as domain\server or server.domain.

David M
  • 71,481
  • 13
  • 158
  • 186
  • What would the connection string look like without integrated authentitacion and fully qualified name. – Benjamin Ortuzar Jul 12 '12 at 17:45
  • Without integrated authentication, you'd lose `Integrated Security=SSPI` and instead have `User name=xxx;Password=xxx` where these are the credentials of a suitable SQL Server logon. – David M Jul 12 '12 at 18:43
  • Would the username include the fully qualified name? Username=Domain\Server1\User1;Password=xxx – Benjamin Ortuzar Jul 12 '12 at 19:27
  • 1
    No, it has to be a SQL Server logon and not a domain logon if you're not using integrated security. – David M Jul 12 '12 at 20:09
2

Would this application need to access network resources on domain A at all?

Because of integrated security, the process has to be launched with domain credentials.

Assuming there is no trust relationship, to do this, you can use RUNAS /NETONLY to have the program being run use another domain credentials for ALL network work (which is why I ask if you will be also working on domain A from that program). http://ss64.com/nt/runas.html

In fact, I modified a program I wrote to relaunch itself with the equivalent Win32 API call in order to ensure that it was launched with domain credentials after I asked this question a few years ago: How to build RUNAS /NETONLY functionality into a (C#/.NET/WinForms) program?

Community
  • 1
  • 1
Cade Roux
  • 88,164
  • 40
  • 182
  • 265
2

This is an example of the connection string I use in order to have SSIS access from a different servers databases on a different domain. Data Source=[IP Address];User ID=[Windows Log In];Password=[Your Password];Initial Catalog=[Your Database Name];Provider=SQLNCLI10.1

Hopefully that helps.

Zane
  • 4,129
  • 1
  • 21
  • 35