简体   繁体   English

查找我的数据库的 DSN?

[英]Finding The DSN To My Database?

I have an SQL database and want to connect to it using VBA in order to support some legacy functionality.我有一个 SQL 数据库,并希望使用 VBA 连接到它以支持某些旧功能。 I'm using an ADODB connection and need to know what my database DSN is.我正在使用 ADODB 连接并且需要知道我的数据库 DSN 是什么。 How can I find this?我怎样才能找到这个?

I'm using SQL Server 2008, thanks!我正在使用 SQL Server 2008,谢谢! :D :D

A DSN ( data source name ) is an indirect way of referring to the database. DSN(数据源名称)是引用数据库的间接方式。 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.转到ControlPanel->AdministrativeTools->DataSources (ODBC)以查看是否已经为要连接的数据库定义了一个。

But I think you might mean "connection string", not "DSN".但我认为您的意思可能是“连接字符串”,而不是“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.有很多方法可以告诉 ADODB 如何查找和连接到您的数据库( DSNs只是其中之一),但您始终需要一个连接字符串。

I have often turned to ConnectionStrings.com to help me through the maze of similar-but-not-identical options.我经常求助于ConnectionStrings.com来帮助我解决类似但不相同的选项的迷宫。

There may not be a DSN.可能没有一个DSN。 DSNs are not created automatically. DSN 不会自动创建。


I'm not sure you really mean DSN, as a DSN is an ODBC concept.我不确定你的意思是 DSN,因为 DSN 是一个 ODBC 概念。 Still, look in Administrative Tools->Data Sources (ODBC).不过,请查看管理工具-> 数据源 (ODBC)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM