There is a recurring problem among Amazing Charts customers that causes access issues to two of the ancillary databases necessary for all of our extractions to work smoothly. Below we describe why this error happens and how to fix it.
Error
The server principal <username> is not able to access the database "codes" under the current security context.and/or:
The server principal <username> is not able to access the database "meds" under the current security context.
Causes
- At the time of setup, the provided Datavant Site Connect database user was not granted read-only access to these ancillary databases.
- During an update by Amazing Charts to the Codes and Meds databases, access to those databases was not reapplied to Datavant Site Connect's user account.
Impact
For the Datavant Site Connect agent to pull NDC and generic drug data, it requires access to the Amazing Chart's Codes and Meds databases.
Note: These databases are often updated by Amazing Charts or assigned DB admins to keep the drug database current.
Resolution
-
Request that your DB admins or Amazing Charts representative reapply the read-only access to the Codes and Meds databases to Datavant Site Connect's user account, or:
-
Self Service:
-
Connect to your Amazing Charts DB instance in Microsoft SQL Server Management Studio.
-
Select "New Query" to open the query editor.
-
Copy, paste and then execute the following code, replacing <sql_username> with the username provided for our Datavant Site Connect Account.
USE codes
CREATE USER <sql_username> FOR LOGIN <sql_username>;
EXEC sp_addrolemember, ‘db_datareader’, ’<sql_username>’
USE meds
CREATE USER <sql_username> FOR LOGIN <sql_username>;
EXEC sp_addrolemember, ‘db_datareader’, ’<sql_username>’ - If the query was successful, you should see a message that reads "Completed Successfully" in the message pane below.
-