创建和 SAS 的 ODBC 连接?
问题说明
我正在编写一个需要访问 SAS 数据的程序.我已经下载了 SAS 的 ODBC 驱动程序并安装了它们,但我需要能够以编程方式即时创建 ODBC 连接.以下代码(在 Python 中)似乎应该可以工作:
I'm writing a program that needs to access SAS data. I've downloaded the ODBC drivers for SAS and installed them, but I need to be able to create ODBC connections on the fly, programmatically. The following code (in Python) seems like it should work:
import ctypes
ODBC_ADD_DSN = 1
def add_dsn(name, driver, **kw):
nul, attrib = chr(0), []
kw['DSN'] = name
for attr, val in kw.iteritems():
attrib.append('%s=%s' % (attr, val))
return ctypes.windll.ODBCCP32.SQLConfigDataSource(0, ODBC_ADD_DSN, driver, nul.join(attrib)) == 1
print add_dsn('SAS Test', 'SAS', description = 'Testing SAS')
但它会弹出SAS ODBC配置对话框,设置数据源名称,并等待用户输入信息并关闭对话框.我怎样才能避免这种情况?
But it pops up the SAS ODBC configuration dialog, sets the datasource name, and waits for the user to enter the information and dismiss the dialog. How can I avoid that?
正确答案
为了获得对 SAS 数据的 ODBC 访问,您需要连接到某种正在运行的 SAS 会话;您无法使用 SAS ODBC 驱动程序直接访问 SAS 数据表文件.
In order to get ODBC access to SAS data, you need to connect to a running SAS session of some kind; you can't access SAS data table files directly with the SAS ODBC drivers.
请参阅 SAS ODBC 驱动程序指南,我需要什么软件?"部分.
See the SAS ODBC drivers guide, section "What Software Do I Need?".
您的问题并未说明您正在尝试通过正在运行的 SAS 产品访问 SAS 数据.SAS ODBC 驱动程序指南应告诉您如何根据您将通过的 SAS 产品建立连接.
Your question doesn't state that you are trying to access SAS data through a running SAS product. The SAS ODBC drivers guide should tell you how to set up the connection based on the SAS product you will make the connection through.
这篇好文章是转载于:学新通技术网
- 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
- 本站站名: 学新通技术网
- 本文地址: /reply/detail/tangicagf
-
YouTube API 不能在 iOS (iPhone/iPad) 工作,但在桌面浏览器工作正常?
it1352 07-30 -
iPhone,一张图像叠加到另一张图像上以创建要保存的新图像?(水印)
it1352 07-17 -
保持在后台运行的 iPhone 应用程序完全可操作
it1352 07-25 -
使用 iPhone 进行移动设备管理
it1352 07-23 -
在android同时打开手电筒和前置摄像头
it1352 09-28 -
检查邮件是否发送成功
it1352 07-25 -
扫描 NFC 标签时是否可以启动应用程序?
it1352 08-02 -
Android微调工具-删除当前选择
it1352 06-20 -
希伯来语的空格句子标记化错误
it1352 06-22 -
Android App 和三星 Galaxy S4 不兼容
it1352 07-20