« Previous Next »

Thread: SQL Server Connection String That Works

Last post 03-18-2009 1:16 PM by featheb. 3 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (4 items)

Sort Posts:

  • 02-09-2009, 1:09 PM

    • featheb
    • Not Ranked
    • Joined on 02-09-2009, 1:03 PM
    • Posts 2

    SQL Server Connection String That Works

    This works for a trusted connection to a named instance of SQL Server 2005:

    -oConnString:"Driver={SQL Native Client};Server=MyServer@Mydomain.Dom\NI1; Database=Reporting; Trusted_Connection=yes;"

    Of Note:

    • Driver={SQL Native Client}
    • Trusted_Connection=yes;
  • 03-11-2009, 4:30 AM In reply to

    • FHM786
    • Not Ranked
    • Joined on 03-09-2009, 12:37 PM
    • Posts 4

    Re: SQL Server Connection String That Works

     C:\Program Files\Log Parser 2.2>logparser -i:w3c "SELECT TO_LOCALTIME(TO_Timesta
    mp(REPLACE_STR(STRCAT(STRCAT(date,' '), time),' GMT',''),'yyyy-M-d h:m:s')) as D
    ateTime, [Server-hostname], [Recipient-Address],[Event-ID], [total-bytes], [Numb
    er-Recipients], TO_LOCALTIME(TO_Timestamp(REPLACE_STR([Origination-time], ' GMT'
    ,''),'yyyy-M-d h:m:s')) as [Origination Time], [Message-Subject], [Sender-Addres
    s] INTO EmailLogs FROM 'C:\20081006.log' where ([Event-ID] = '1033') or ([Event-
    ID] = '1020')" -o:SQL -oConnString:"Driver={SQL Native Client};Server="dursql02"
    ; Database="MscDW"; Trusted_Connection=yes;username=XXXXX;password=XXXXX" -cre
    ateTable:ON
    Task aborted.
    Error connecting to ODBC Server
      SQL State:     08001
      Native Error:  53
      Error Message: [Microsoft][SQL Native Client]Named Pipes Provider: Could
      not open a connection to SQL Server [53].


    Statistics:
    -----------
    Elements processed: 0
    Elements output:    0
    Execution time:     16.17 seconds

     

    ________________________________________________________________________

     C:\Program Files\Log Parser 2.2>logparser -i:w3c "SELECT TO_LOCALTIME(TO_Timesta
    mp(REPLACE_STR(STRCAT(STRCAT(date,' '), time),' GMT',''),'yyyy-M-d h:m:s')) as D
    ateTime, [Server-hostname], [Recipient-Address],[Event-ID], [total-bytes], [Numb
    er-Recipients], TO_LOCALTIME(TO_Timestamp(REPLACE_STR([Origination-time], ' GMT'
    ,''),'yyyy-M-d h:m:s')) as [Origination Time], [Message-Subject], [Sender-Addres
    s] INTO EmailLogs FROM 'C:\20081006.log' where ([Event-ID] = '1033') or ([Event-
    ID] = '1020')" -o:SQL -oConnString:"Driver={SQL Native Client};Server=dursql02;
    Database=MscDW; Trusted_Connection=yes;username=XXXXX;password=XXXXX" -createT
    able:ON
    Task aborted.
    An error occurred while uploading data to SQL table
      SQL State:     42000
      Native Error:  7202
      Error Message: [Microsoft][SQL Native Client][SQL Server]Could not find
      server 'DURSQL02' in sys.servers. Verify that the correct server name was
      specified. If necessary, execute the stored procedure sp_addlinkedserver to
      add the server to sys.servers.


    Statistics:
    -----------
    Elements processed: 426
    Elements output:    80
    Execution time:     0.34 seconds


    C:\Program Files\Log Parser 2.2>

     

     

     

    Please help

  • 03-11-2009, 6:22 AM In reply to

    Re: SQL Server Connection String That Works

     Hi,

    seems that named instance is either blocked or not yet enabled. I'll suggest you to check its remote connectivity via MSSQL Management studio, if it works, then its for sure that you will need to enable named instance in the configuration setting (below TCP/IP under configuration)

    --------------------
    Tanmaya
    Your Internet Identity Partner
  • 03-18-2009, 1:16 PM In reply to

    • featheb
    • Not Ranked
    • Joined on 02-09-2009, 1:03 PM
    • Posts 2

    Re: SQL Server Connection String That Works

    Hey Folks!

    #1

    Are you using the fully qualified name of the server? And is the server installed as the Default Instance or as a Named Instance?

     

    #2 

    I do not understand why you are trying to use both modes of logon/authentication. In

    -oConnString:"Driver={SQL Native Client};Server="dursql02"; Database="MscDW"; Trusted_Connection=yes;username=XXXXX;password=XXXXX"

    You are using

    • Trusted_Connection=yes
    • username=XXXXX;password=XXXXX

    These entries are mutually exclusive. 

    Trusted_connection=yes (or SSPI=yes) tells the connection to use the current Windows/network/ActiveDirectory credentials to authenticate to SQL Server for login. You do not want to use the other entry because all of the information (user id, ect...) already exists.  

    username=XXXXX;password=XXXXX (a login/password pair) is used when you do not want to use Windows credentials.  It is using a SQL Server Login and password with an associated Database User that has associated permissions

     

     

     

Page 1 of 1 (4 items)
Microsoft Communities