question

AgashePrateek-1075 avatar image
0 Votes"
AgashePrateek-1075 asked OuryBa-MSFT commented

DB read only replica

I want to connect to the Database read replica. From the documentation I found that to connect to a read replica DB, we need to pass ApplicationIntent=ReadOnly in the conncetion string.
I am using Sequelize library to make DB connection(mssql), but I am not getting where I need to pass ApplicationIntent=ReadOnly in the connection using Sequelize (in node js).

azure-database-mysql
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @AgashePrateek-1075 Thank you for posting your question. We are looking into this and will get back shortly.

Regards,
Oury

0 Votes 0 ·

@AgashePrateek-1075 Can you please confirm if you are using Azure SQL or Azure Databases for Mysql. In the tag it is mentioned azure -database-mysql. Thanks

0 Votes 0 ·

@OuryBa-MSFT I am using Azure SQL services. Sorry for the incorrect tag.

0 Votes 0 ·

1 Answer

OuryBa-MSFT avatar image
0 Votes"
OuryBa-MSFT answered OuryBa-MSFT commented

Hello @AgashePrateek-1075 Thank you for being patient while working on this.
You can use ApplicationIntent=ReadOnly in the connection string in SSMS. You can use the Login UI in SSMS or ADS to specify server/database/login name, and then add ApplicationIntent=ReadOnly in the additional parameters box, or in the corresponding place in ADS From SSMS, you can pass the parameter under additional connection properties as below: Please refer to this documentation for more details.

95608-image.png

Hope that helps. Please let me know the result.
Accept answer if that helps so it can be beneficial for other communities members with similar issues.

Regards,
Oury



image.png (100.4 KiB)
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @AgashePrateek-1075 Please let us know if the answer above was helpful. Thanks

0 Votes 0 ·

Hi @OuryBa-MSFT Sorry for the delay from my end.
From SSMS I was able to connect to read replica DB, but want to achieve the same from the NODE side using Sequelize library.
Tried passing Application Intent in the code like below but didn't worked:
const dbConfig = {
host: process.env.DB_HOST,
username: process.env.DB_USERNAME,
password: process.env.DB_PASSWORD,
database: process.env.DB_NAME,
dialect: process.env.DB_DIALECT,
dialectOptions: {
options: {
'ApplicationIntent':'readonly',
encrypt: toBoolean(process.env.DB_ENCRYPT),
database: process.env.DB_NAME,
requestTimeout: 180000
}
}
}


0 Votes 0 ·

Hello @AgashePrateek-1075 Not sure if there is a connection string corresponding to Application Intent when using Node.js. I did few research and found this documentation


0 Votes 0 ·