Robot Framework-数据库库如何使用Windows身份验证进行连接

时间:2019-01-29 14:33:22

标签: sql database robotframework pyodbc

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

<link rel="canonical" href="https://www.instagram.com/superjumpbelgium/p/BtJnyR3lb6o/">
    <meta content="112 Likes, 5 Comments - SuperJump (@superjumpbelgium) on Instagram: “How #cool is this &zwj;♀️ #flip #salto #superjump”" name="description">
    <meta property="og:site_name" content="Instagram">
    <meta property="og:title" content="SuperJump on Instagram: “How #cool is this &zwj;♀️ #flip #salto #superjump”">
    <meta property="og:image" content="https://scontent-bru2-1.cdninstagram.com/vp/c29fb33d61be461420ca3c97c62c3c63/5C53739C/t51.2885-15/e15/50160334_111325143309745_7951846762696340671_n.jpg?_nc_ht=scontent-bru2-1.cdninstagram.com">
    <meta property="og:description" content="112 Likes, 5 Comments - SuperJump (@superjumpbelgium) on Instagram: “How #cool is this &zwj;♀️ #flip #salto #superjump”">
    <meta property="fb:app_id" content="124024574287414">
    <meta property="og:url" content="https://www.instagram.com/p/BtJnyR3lb6o/">
    <meta property="instapp:owner_user_id" content="5841998081">
    <meta property="al:ios:app_name" content="Instagram">
    <meta property="al:ios:app_store_id" content="389801252">
    <meta property="al:ios:url" content="instagram://media?id=1966277691297873576">
    <meta property="al:android:app_name" content="Instagram">
    <meta property="al:android:package" content="com.instagram.android">
    <meta property="al:android:url" content="https://www.instagram.com/p/BtJnyR3lb6o/">

    <meta name="medium" content="video">
    <meta property="og:type" content="video">
    <meta property="og:video" content="https://scontent-bru2-1.cdninstagram.com/vp/46df451cb72839072bc7ab6078dc3d0f/5C52A4BB/t50.2886-16/51464036_412254452675177_32285228113

连接字符串:

*** 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;))

1 个答案:

答案 0 :(得分:1)

请勿使用分号(;)作为分隔符,而应使用逗号(,):

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

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


原因是您提供的字符串turns up as-is in the connect() method-因此它们必须遵循方法参数的正确python语法。