web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics GP (Archived)

Integration Manager: Scripted connection to remote database

(0) ShareShare
ReportReport
Posted on by 207

I need to access data from a database on a remote server, running in the "After Document" script.  However, I cannot get it to use anything but the currently logged in user account.  My script is:

Set MyCon = CreateObject("ADODB.Connection")
MyCon.ConnectionString = "SERVER=remotesql;DSN=remotedb;UID=sa;PWD=sapassword;"
GPConnection.Open(MyCon)

I can verify it connects to the remotesql server, because I can lock out the sa account if I run logged in as sa (it's using the local sa credentials, locking out the remote sa account).

I've tried everything I can think of, but the UID is ignored.  Any thoughts?

Thank you.

*This post is locked for comments

I have the same question (0)
  • SaintFrag Profile Picture
    207 on at

    I figured it out (of course, because I posted here so naturally I'd find a solution shortly after).

    GPConnection natively used your current credentials.  So instead:

    Set MyConE = CreateObject("ADODB.Connection")

    MyConE.ConnectionString = "Provider=SQLOLEDB;SERVER=remotesql;database=remotedatabase;UID=sa;PWD=mysapassword;"

    MyConE.Open(MyConE)

    Of course, I'm connecting to a remote SQL Server, so Provider may be different.  But that's what works in my situation.

  • SaintFrag Profile Picture
    207 on at

    Well, it worked the first time I tested.  Or I was stupid.  Now I get an error:  "integration object required: gpobj".

  • Verified answer
    SaintFrag Profile Picture
    207 on at

    Corrected the bug with this:

    Set MyConE = CreateObject("ADODB.Connection")

    MyConE.ConnectionString = "Provider=SQLOLEDB;SERVER=remotesql;database=remotedatabase;UID=sa;PWD=mysapassword;"

    MyConE.Open

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics GP (Archived)

#1
mtabor Profile Picture

mtabor 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans