dcsimg
Results 1 to 8 of 8

Thread: Connecting UFT with Microsoft SQL server 2014

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2019
    Posts
    7

    Connecting UFT with Microsoft SQL server 2014

    I am trying to integrate UFT with Microsoft SQL server 2014 but it's throwing error invalid connection attribute. Please find my code below

    Set objcon = Createobject ("ADODB.Connection")
    Set objrecset = Createobject("ADODB.Recordset")

    objcon.Open "Provider=sqloledb;Data Source=Name of the server; Initial Catalogue=Name of DB; username=username; password=password"


    My SQL browser service is disabled is this a reason for the failure. Please help.

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    40,822

    Re: Connecting UFT with Microsoft SQL server 2014

    Initial Catalogue and other parts are not correct.

    As mentioned in the other thread, you should find a valid example for your situation here first: http://www.connectionstrings.com/sql-server/ (now I can see that you want this section of the page: https://www.connectionstrings.com/mi...rver-sqloledb/ )

    Once you find an example, make sure all of the parts are the same (except things like the values for your database name etc).

  3. #3
    PowerPoster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,229

    Re: Connecting UFT with Microsoft SQL server 2014

    Here is the string I use:

    "Server=YOUR\SERVER;Database=YOURDATABASE;Driver=SQL Server;Trusted_Connection=Yes"
    Please remember next time...elections matter!

  4. #4

    Thread Starter
    New Member
    Join Date
    Mar 2019
    Posts
    7

    Re: Connecting UFT with Microsoft SQL server 2014

    I have corrected the initial catalog but still not able to connect. Can u please tell me what other parts are incorrect?
    I have seen the link and feel like all the details i have given are similar to the examples that you have given

    Please find below my code:

    Set objcon = CreateObject("ADODB.Connection")
    Set objrec = CreateObject("ADODB.RecordSet")


    objcon.Open "Provider=sqloledb; Trusted_Connection=Yes; Data Source=ServerName; Initial Catalog=DBName; username=LoginUsername; password=LoginPassword"

    objrec.Open DBQuery,objcon

    Value = objrec.fields.item(0)
    msgbox Value

  5. #5
    PowerPoster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,229

    Re: Connecting UFT with Microsoft SQL server 2014

    still not able to connect
    Any error messages

    Did you try the string I suggested?
    Please remember next time...elections matter!

  6. #6

    Thread Starter
    New Member
    Join Date
    Mar 2019
    Posts
    7

    Re: Connecting UFT with Microsoft SQL server 2014

    Yes i tried your one as well .. error message is "Invalid connection string attribute" ..

  7. #7
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    40,822

    Re: Connecting UFT with Microsoft SQL server 2014

    Quote Originally Posted by Abhi1987 View Post
    Can u please tell me what other parts are incorrect?
    Almost all of it.

    I have seen the link and feel like all the details i have given are similar to the examples that you have given
    Similar is obviously not good enough, otherwise it would be working. You need an exact match.

    The site I linked to is used by many thousands of people, and all of their examples are very well tested - they all work (for the situations specified).

    Copy and paste one of the ones from the site I linked to (pick one that suits your situation), and then enter your database name etc as apt.

  8. #8
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    CT
    Posts
    17,837

    Re: Connecting UFT with Microsoft SQL server 2014

    Quote Originally Posted by si_the_geek View Post
    The site I linked to is used by many thousands of people, and all of their examples are very well tested - they all work (for the situations specified).
    I contributed a connection string to that site a long time ago - back when CE devices were popular! Still got my name in lights!

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width