Skip to content

Commit 440ab50

Browse files
committed
added sql azure synpase serverless sql pool and azure sql edge
1 parent 370cf6c commit 440ab50

File tree

1 file changed

+26
-18
lines changed

1 file changed

+26
-18
lines changed

src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnection.java

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,12 @@ public class SQLServerConnection implements ISQLServerConnection, java.io.Serial
142142

143143
private boolean sendTemporalDataTypesAsStringForBulkCopy = true;
144144

145-
final int ENGINE_EDITION_FOR_SQL_AZURE = 5;
146-
final int ENGINE_EDITION_FOR_SQL_AZURE_DW = 6;
147-
final int ENGINE_EDITION_FOR_SQL_AZURE_MI = 8;
145+
final int ENGINE_EDITION_SQL_AZURE_DB = 5;
146+
final int ENGINE_EDITION_SQL_AZURE_SYNAPSE_ANALYTICS = 6;
147+
final int ENGINE_EDITION_SQL_AZURE_MI = 8;
148+
final int ENGINE_EDITION_SQL_AZURE_SQL_EDGE = 9;
149+
final int ENGINE_EDITION_SQL_AZURE_SYNAPSE_SERVERLESS_SQL_POOL = 11;
150+
148151
private Boolean isAzure = null;
149152
private Boolean isAzureDW = null;
150153
private Boolean isAzureMI = null;
@@ -6547,21 +6550,23 @@ public void onEviction(CityHash128Key key, PreparedStatementHandle handle) {
65476550
/**
65486551
* Checks if connection is established to SQL Azure server
65496552
*
6550-
* SERVERPROPERTY('EngineEdition') is used to determine if the db server is SQL Azure. It should return 6 for SQL
6551-
* Azure DW. This is more reliable than @@version or serverproperty('edition').
6553+
* SERVERPROPERTY('EngineEdition') is used to determine if the db server is SQL Azure. This is more reliable
6554+
* than @@version or serverproperty('edition').
65526555
*
6553-
* Reference: http://msdn.microsoft.com/en-us/library/ee336261.aspx
6556+
* Reference: https://docs.microsoft.com/en-us/sql/t-sql/functions/serverproperty-transact-sql?view=sql-server-ver15
65546557
*
65556558
* <pre>
65566559
* SERVERPROPERTY('EngineEdition') means
65576560
* Database Engine edition of the instance of SQL Server installed on the server.
6558-
* 1 = Personal or Desktop Engine (Not available for SQL Server.)
6559-
* 2 = Standard (This is returned for Standard and Workgroup.)
6560-
* 3 = Enterprise (This is returned for Enterprise, Enterprise Evaluation, and Developer.)
6561-
* 4 = Express (This is returned for Express, Express with Advanced Services, and Windows Embedded SQL.)
6562-
* 5 = SQL Azure
6563-
* 6 = SQL Azure DW
6564-
* 8 = Managed Instance
6561+
* 1 = Personal or Desktop Engine (Not available in SQL Server 2005 (9.x) and later versions)
6562+
* 2 = Standard (This is returned for Standard, Web, and Business Intelligence.)
6563+
* 3 = Enterprise (This is returned for Evaluation, Developer, and Enterprise editions.)
6564+
* 4 = Express (This is returned for Express, Express with Tools, and Express with Advanced Services)
6565+
* 5 = SQL Database
6566+
* 6 = Microsoft Azure Synapse Analytics
6567+
* 8 = Azure SQL Managed Instance
6568+
* 9 = Azure SQL Edge (This is returned for all editions of Azure SQL Edge)
6569+
* 11 = Azure Synapse serverless SQL pool
65656570
* Base data type: int
65666571
* </pre>
65676572
*
@@ -6575,11 +6580,14 @@ boolean isAzure() {
65756580
rs.next();
65766581

65776582
int engineEdition = rs.getInt(1);
6578-
isAzure = (engineEdition == ENGINE_EDITION_FOR_SQL_AZURE
6579-
|| engineEdition == ENGINE_EDITION_FOR_SQL_AZURE_DW
6580-
|| engineEdition == ENGINE_EDITION_FOR_SQL_AZURE_MI);
6581-
isAzureDW = (engineEdition == ENGINE_EDITION_FOR_SQL_AZURE_DW);
6582-
isAzureMI = (engineEdition == ENGINE_EDITION_FOR_SQL_AZURE_MI);
6583+
isAzure = (engineEdition == ENGINE_EDITION_SQL_AZURE_DB
6584+
|| engineEdition == ENGINE_EDITION_SQL_AZURE_SYNAPSE_ANALYTICS
6585+
|| engineEdition == ENGINE_EDITION_SQL_AZURE_MI
6586+
|| engineEdition == ENGINE_EDITION_SQL_AZURE_SQL_EDGE
6587+
|| engineEdition == ENGINE_EDITION_SQL_AZURE_SYNAPSE_SERVERLESS_SQL_POOL);
6588+
isAzureDW = (engineEdition == ENGINE_EDITION_SQL_AZURE_SYNAPSE_ANALYTICS
6589+
|| engineEdition == ENGINE_EDITION_SQL_AZURE_SYNAPSE_SERVERLESS_SQL_POOL);
6590+
isAzureMI = (engineEdition == ENGINE_EDITION_SQL_AZURE_MI);
65836591

65846592
} catch (SQLException e) {
65856593
if (loggerExternal.isLoggable(java.util.logging.Level.FINER))

0 commit comments

Comments
 (0)