ShortQuery

This forum is for programmers who have questions about the source code.
Post Reply
brick-william
Posts: 2
Joined: Mon Jul 26, 2021 6:28 pm

ShortQuery

Post by brick-william » Mon Jul 26, 2021 6:35 pm

I am trying to retrieve some data from database, but when I run https://api.opendental.com/api/v1/queries/ShortQuery (PUT), I get an error that "An SQL error occured: Authentication to host 'localhost' for user '' using method 'mysql_native_password' failed with message: Access denied for user ''@'localhost' to database 'demo'"

The body of the api is:
{
"SqlCommand": "SELECT LName FROM provider WHERE ProvNum = 1"
}
this is a simple query that I use to test whether I can run query using the ShortQuery api or not. Any help would be appreciated.

thanks

SLeon
Posts: 476
Joined: Mon Mar 01, 2021 10:00 am

Re: ShortQuery

Post by SLeon » Tue Jul 27, 2021 8:59 am

The ShortQuery method will use the ''@localhost MySql user for your database by default, unless you have specifically set up a different UserLow (which is rare). This ''@localhost user has no permissions granted by default, so you just need to grant that MySql user SELECT privileges to be able to run your query.

brick-william
Posts: 2
Joined: Mon Jul 26, 2021 6:28 pm

Re: ShortQuery

Post by brick-william » Tue Jul 27, 2021 10:57 am

thank you SLeon, it works. :)

User avatar
jordansparks
Site Admin
Posts: 5739
Joined: Sun Jun 17, 2007 3:59 pm
Location: Salem, Oregon
Contact:

Re: ShortQuery

Post by jordansparks » Thu Jul 29, 2021 7:15 pm

Hmm. This doesn't seem right. Didn't we change that to use the normal MySQL user? I'm on vacation for a week, but I didn't want to forget to circle back around to this. In other words, the ShortQuery should work out of the box without any additional setup.
Jordan Sparks, DMD
http://www.opendental.com

mandmdiet
Posts: 113
Joined: Tue Aug 17, 2021 9:37 am

Re: ShortQuery

Post by mandmdiet » Fri Sep 03, 2021 9:03 am

We did have to grant @localhost read access as well to get the API to work for ShortQuery. Is this something that you think is being changed JordanSparks? We need to include it in our evaluation of which integration options to use with Open Dental if we need to set this configuration on all of the our client's machines.

User avatar
jordansparks
Site Admin
Posts: 5739
Joined: Sun Jun 17, 2007 3:59 pm
Location: Salem, Oregon
Contact:

Re: ShortQuery

Post by jordansparks » Mon Sep 06, 2021 5:54 pm

I think it's already fixed, but if not, I would consider it a bug and we will fix it. No changes to MySQL users should be required.
Jordan Sparks, DMD
http://www.opendental.com

Post Reply