Robot Framework-数据库库如何使用Windows身份验证进行连接 [英] Robot Framework - Database library how to connect using Windows Authentication

查看:100
本文介绍了Robot Framework-数据库库如何使用Windows身份验证进行连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Windows身份验证连接到SQL Server数据库,我尝试了以下操作:

I am trying to connect to SQL server database using windows authentication, i Have tried the following:

*** Settings ***
Suite Setup  Connect To Database Using Custom Params   pyodbc    ${DBHost_ConnectionString}

Suite Teardown    Disconnect From Database

连接字符串:

${DBHost_ConnectionString}=        Server=ServerName;Database=DbName;Trusted_Connection=yes;

哪个生产

pyodbc.connect(db_api_2.connect(Server=ServerName;Database=DbName;Trusted_Connection=yes;))

这是错误:

SyntaxError: invalid syntax (<string>, line 1)

推荐答案

不要使用分号(; )作为分隔符,请使用逗号():

Don't use semicolon (;) as delimiters, use commas (,):

${DBHost_ConnectionString}=  Set Variable    Server='ServerName', Database='DbName', Trusted_Connection='yes'

也不要忘记将参数值放在引号中.

Also don't forget to put the arguments values in quotes.

原因是您提供的字符串

The reason is the string you provide turns up as-is in the connect() method - so they must follow the proper python syntax for method's arguments.

这篇关于Robot Framework-数据库库如何使用Windows身份验证进行连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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