简体   繁体   中英

Fail to query from any database on Azure SQL Database

I try to connect to one of my Azure Database jdbc:sqlserver://***.database.windows.net:1433;database=Product , I can query from Product.

Then I try to connect my Azure database jdbc:sqlserver://***.database.windows.net:1433 and fail to query from any database any table with error "Reference to database and/or server name is not supported in this version of SQL Server"

Is this related to cross database query mentioned in Cross-Database Queries in Azure SQL Database ? If not, is there any method to do a connection to query from any database?

As per the Microsoft official documentation , this is the standard and recommended way in configure file to connect with Azure SQL Database.

You can use environment variable to change the database name.

Set database=YOUR_DB_NAME and use the variable name in the URL:

jdbc:sqlserver://***.database.windows.net:1433;${database}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM