Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Flatly)
  • No Skin
Collapse
Brand Logo

NetXMS Forum

  1. Home
  2. Support
  3. Unable to query SQL Server 2016 using dbquery.nsm

Unable to query SQL Server 2016 using dbquery.nsm

Scheduled Pinned Locked Moved Support
9 Posts 3 Posters 49.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S
    S
    stoffmann
    wrote on last edited by
    #1

    Hi,

    I try to query some data from an MS SQL Server 2016, but can't get it working.

    My Agent config (xxx means confidential):

    MasterServers = xxx
    ConfigIncludeDir = D:\Program Files\NetXMSAgent\etc\nxagentd.conf.d
    LogFile = D:\Program Files\NetXMS\log\agent.log
    DebugLevel = 4
    FileStore = D:\Program Files\NetXMSAgent\var
    SubAgent = filemgr.nsm
    SubAgent = ping.nsm
    SubAgent = logwatch.nsm
    SubAgent = winperf.nsm
    SubAgent = wmi.nsm
    SubAgent = dbquery.nsm

    ExecTimeout=60000
    ExternalParameterShellExec=Custom.EBGroupUsers:net localgroup "Engineering Base" | find /c "\"

    *DBQUERY
    Database = id=db1;driver=mssql.ddr;server=xxx(IP ADDRESS);dbname=master;login=xxx;password=xxx
    Query = SQL.RecoverModel:db1:600:SELECT Count(name) FROM sys.databases WHERE recovery_model<>3 and name not in ('msdb','model','master')

    I'm sure username and password works.

    In the agent log I get:

    DBQUERY: cannot connect to database db1 ([Microsoft][SQL Server Native Client 11.0]Named Pipes Provider: Could not open a connection to SQL Server [2]. )
    DBQUERY: H_DirectQueryConfigurable: no connection handle for database db1

    Named Pipes and TCP/IP is enabled in configuration manager.

    I use NetXMS Version 3.2.380

    Best regards

    Stefan

    1 Reply Last reply
    0
    • V
      V
      Victor Kirhenshtein
      wrote on last edited by
      #2

      Hi,

      configuration looks good. Is hybrid authentication enabled? Also, could it be that password contains some characters that could be misinterpreted (like: ; # ' ")?

      Best regards,
      Victor

      1 Reply Last reply
      0
      • S
        S
        stoffmann
        wrote on last edited by
        #3

        Hi,

        I think You mean "Mixed Mode Authentication" in SQL Server? This is enabled. Password only uses upper and lowercase chars with some numbers.
        Checking the SQL server logs shows that there is no try to login from the login used by the agent.
        Very strange.

        Do You have more ideas?

        Regards

        Stefan

        1 Reply Last reply
        0
        • V
          V
          Victor Kirhenshtein
          wrote on last edited by
          #4

          Hi,

          I did some testing on my system, and I can get this error if TCP/IP is disabled in native client configuration. Check "Client Protocols" section under "SQL Native Client 11.0 Configuration" in "SQL Server Configuration Manager".

          Best regards,
          Victor

          1 Reply Last reply
          0
          • S
            S
            stoffmann
            wrote on last edited by
            #5

            Hi Victor,

            I will check this, when I'm back from vacation in two weeks.

            Regards

            Stefan

            1 Reply Last reply
            0
            • S
              S
              stoffmann
              wrote on last edited by
              #6

              Hi, I'm back from vacation now and checked the configuration again.
              TCP/IP is enabled for Native Client 32bit and 64bit. (see screenshots)
              Is there anything I could test?

              Best regards

              Stefan


              2020-06-16 09_34_35-Window.png

              2020-06-16 09_34_59-Window.png

              1 Reply Last reply
              0
              • S
                S
                stoffmann
                wrote on last edited by
                #7

                I still have this problem. Is there a way to get more information to find out where the problem is?

                1 Reply Last reply
                0
                • S
                  S
                  stoffmann
                  wrote on last edited by
                  #8

                  I finally found the problem. Man, I'm so stupid. I forgot to add the instance name after the servername in the agent config ::)

                  1 Reply Last reply
                  0
                  • F
                    F
                    Filipp Sudanov
                    wrote on last edited by
                    #9

                    Thanks for the follow up

                    1 Reply Last reply
                    0

                    Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                    Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                    With your input, this post could be even better 💗

                    Register Login
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    Powered by NodeBB Contributors
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups