2006年02月06日 星期一 21:29
Hi all,
在python 中odbc moudule是这样说的:
odbc.odbc
connection = odbc(connectionString)
Creates an ODBC connection
Parameters
connectionString : string
An ODBC connection string. For backwards-compatibility, this parameter can be of the form DSN[/username[/password]] (e.g. "myDSN/myUserName/myPassword"). Alternatively, a full ODBC connection string can be used (e.g., "Driver={SQL Server};Server=(local);Database=myDatabase").
我想使用第二中方法:
connection=odbc.odbc("Driver={SQL Server};Server=(local);Database=mydb")
连接本地数据库是可以。
但是如果我是要连接其他的电脑上的数据库呢?
我改成:
connection=odbc.odbc("Driver={SQL Server};Server='192.168.1.11';Database=mydb")
出现dbi.operation-error: [Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server 不存在或访问被拒绝 in LOGIN 的错误。
另外,如果我要输入用户和密码有要怎么弄呢?
如果使用数据源,同样我要连接别的电脑上的数据库要怎么写啊??
谁有相关的例子可以参考参考么?
谢谢了!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060206/49c2d7c6/attachment.html
2006年02月07日 星期二 00:27
在连接串中加上用户名和密码 "...UID=xxx;PWD=xxx"就好了。或者采用基于别的认证方式的连接.
connection=odbc.odbc("Driver={SQL Server};Server='192.168.1.11
';Database=mydb;UID=xxx;PWD=xxx")
Good luck.
在06-2-6,asong <asong43 at sohu.com> 写道:
>
> Hi all, 在python 中odbc moudule是这样说的: odbc.odbc
>
> connection = *odbc(connectionString*)
>
> Creates an ODBC connection
>
> Parameters
>
> *connectionString* : string
>
> An ODBC connection string. For backwards-compatibility, this parameter can
> be of the form DSN[/username[/password]] (e.g.
> "myDSN/myUserName/myPassword"). Alternatively, a full ODBC connection
> string can be used (e.g., "Driver={SQL
> Server};Server=(local);Database=myDatabase").
>
> 我想使用第二中方法:
> connection=odbc.odbc("Driver={SQL Server};Server=(local);Database=mydb")
> 连接本地数据库是可以。
> 但是如果我是要连接其他的电脑上的数据库呢?
> 我改成:
> connection=odbc.odbc("Driver={SQL Server};Server='192.168.1.11
> ';Database=mydb")
>
> 出现dbi.operation-error: [Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL
> Server 不存在或访问被拒绝 in LOGIN 的错误。
>
> 另外,如果我要输入用户和密码有要怎么弄呢?
> 如果使用数据源,同样我要连接别的电脑上的数据库要怎么写啊??
> 谁有相关的例子可以参考参考么?
> 谢谢了!
>
>
>
>
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060207/54be7821/attachment.htm
Zeuux © 2025
京ICP备05028076号