链接到SQL [英] Linking to SQL

查看:72
本文介绍了链接到SQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在将数据库链接到不同的SQL服务器时遇到问题。我让它在我自己的机器上运行良好,但是当它在客户端和另一个办公室分发时,Link无法正常工作。它要么超时,要么给出错误。


我创建了一个LinkTables方法(下面),它允许我将DB分发给在另一台服务器上运行的客户端。我创建了一个本地设置表来存储不同位置的连接字符串。我想要使​​用DSN文件,要么完全通过代码连接。我不想在任何人的机器上设置系统/用户ODBC连接。不幸的是,我不是那个测试它的人,但由于某种原因,技术无法连接到SQL,没有手动设置系统ODBC。这就是我改为ADP的原因,因为它更容易连接。


无论如何,这里是我的代码和测试连接字符串。任何人都有评论为什么这不起作用?另外,连接字符串中需要什么?


谢谢。

展开 | 选择 | 换行 | 行号

解决方案

我不知道你是否注意到你的连接字符串中的DATABASE子句被设置为:


" ODBC; DRIVER = SQL Server; UID = user; PWD = pass; SERVER = CORPMAT; DATABASE = A uditTest"



''uditTest'中的空格看起来很可疑。


这只是来自副本的错字/糊。在我的代码中不是这样的。


这个代码在我的本地机器上工作正常,所以我不明白为什么它不会在现场。其实我明天要去他们个人尝试一下。在我做之前,我可以提供的信息不多,即。错误消息等


一个主要区别是我在Win XP桌面上本地运行MSSQL 2K。现场他们在deticated服务器上运行MSSQL 2K,并通过网络连接。


任何人都可以想到Access无法使用此测试连接字符串连接到SQL的原因,假设服务器,数据库,用户名和密码是正确的?服务器上是否有设置,安全性或其他方式阻止它?


此外,连接中的WSID,APP和其他选项如何?是否有必要?


感谢您的时间


标准安全:

ODBC; Driver = {SQLServer}; Server = CORPMAT;

Database = AuditTest; Uid = Your_Username; Pwd = Your_Pass word;"

可信连接:

" ODBC; Driver = {SQLServer}; Server = CORPMAT;

Database = AuditTest; Trusted_Connection =是;"

I''m having problems getting my DB to Link to different SQL servers. I got it to work fine on my own machine, but when distributed it at the client, and to another office, the Link didn''t work. It either timed out, or gave errors.

I created a LinkTables Method (below) that would allow me to distribute the DB to the client running on another server. I created a local Settings table to store the Connection Strings of different locations. I wanted to either use a DSN file, or connect completely through code. I didn''t want to setup System/User ODBC connections on anybody''s machine. Unfortunately, I wasn''t the one testing it out, but for some reason the tech could not get connected to SQL, without setup up a System ODBC manually. That''s the reason I changed to ADP, because it was easier to connect.

Anyway, here''s my code, and Test Connection String. Anyone have comments why this would not work? Also, what is required in the Connection String?

Thanks.

Expand|Select|Wrap|Line Numbers

解决方案

I don''t know if you noticed but the DATABASE clause in your connection string is set to :

"ODBC;DRIVER=SQL Server;UID=user;PWD=pass;SERVER=CORPMAT;DATABASE=A uditTest"

The spaces in ''A uditTest'' look suspicious.


That''s just a typo from the copy/paste. It''s not that way in my code.

This code works fine on my local machine, so I don''t see why it wouldn''t onsite. Actually I''m going their tomorrow to personally try it out. Until I do there''s not much more info I can give, ie. Error Messages etc.

One main difference is I''m running MSSQL 2K locally on my Win XP desktop. Onsite they are running MSSQL 2K on a deticated server, and connecting through a network.

Can anyone think of a reason why Access wouldn''t connect to SQL using this Test Connection String, assuming the Server, Database, Username and Password are correct? Could there be settings, security or otherwise on the server that''s preventing it?

Also, what about WSID, APP and other options in the connection? Are any of those necessary?

Thanks for your time


Standard Security:
"ODBC;Driver={SQLServer};Server=CORPMAT;
Database=AuditTest;Uid=Your_Username;Pwd=Your_Pass word;"

Trusted connection:
"ODBC;Driver={SQLServer};Server=CORPMAT;
Database=AuditTest;Trusted_Connection=yes;"


这篇关于链接到SQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆