Error "USE statement is not supported to switch between databases" when setting up an Information Services data source to Azure SQL Database.

Error "USE statement is not supported to switch between databases" when setting up an Information Services data source to Azure SQL Database.

book

Article ID: KB0078752

calendar_today

Updated On:

Products Versions
Spotfire Server 7.11 and higher

Description

When setting up a Data Source connection to Azure SQL Database in Information Designer, you might get this error message when trying to expand the database:
 
InformationModelException at Spotfire.Dxp.Data:
Error retrieving metadata: USE statement is not supported to switch between databases. Use a new connection to connect to a different database. (HRESULT: 80131500)
...

If the account you are using has one of the databases set as default, you should be able to expand that database, but not the others.

Issue/Introduction

To avoid getting the error "USE statement is not supported to switch between databases" when setting up an Information Services data source to Azure SQL Database, create one data source per database and use accounts which have this database set as default.

Environment

Spotfire Server and Azure SQL Database as a data source to be accessed by Information Services

Resolution

This is one of the differences between SQL Server and Azure SQL Database, where the latter does not support the USE command. 

The solution to this is to create one data source per database, and to use an account which has this database as default. This way the connection does not need to change database (and therefor does not call the USE command).

One caveat is that you will this way setup a different connection pool for each database, instead of using the same pool for several databases.