16

I have an SQL database and want to connect to it using VBA in order to support some legacy functionality. I'm using an ADODB connection and need to know what my database DSN is. How can I find this?

I'm using SQL Server 2008, thanks! :D

sooprise
  • 22,657
  • 67
  • 188
  • 276

2 Answers2

23

A DSN (data source name) is an indirect way of referring to the database. You have to create them manually (or semi-automatically using a wizard of some kind). Go to ControlPanel->AdministrativeTools->DataSources (ODBC) to see if one has already been defined for the database to which you want to connect.

But I think you might mean "connection string", not "DSN". There are many, many ways to tell ADODB how to find and connect to your database (DSNs are just one of those), but you always need a connection string.

I have often turned to ConnectionStrings.com to help me through the maze of similar-but-not-identical options.

egrunin
  • 24,650
  • 8
  • 50
  • 93
  • 1
    +1 It would have been slightly more helpful to include what "DSN" stands for. I think it stands for "database source name," but someone correct me if that is not right (I am also new to all of this). – Shadoninja Sep 21 '17 at 18:12
  • @Shadoninja - Edited (three years later) as per your suggestion. – egrunin Feb 05 '20 at 20:48
0

There may not be a DSN. DSNs are not created automatically.


I'm not sure you really mean DSN, as a DSN is an ODBC concept. Still, look in Administrative Tools->Data Sources (ODBC).

John Saunders
  • 160,644
  • 26
  • 247
  • 397