azureidentity-mysql-db-connector
v1.0.2
Published
The `azureidentity-mysql-db-connector` is a Node.js library designed to simplify the process of connecting to a MySQL database using Azure Identity for authentication.
Readme
Azure Identity MySQL DB Connector
The azureidentity-mysql-db-connector is a Node.js library designed to simplify the process of connecting to a MySQL database using Azure Identity for authentication.
Features
- Secure connection to MySQL databases using Azure Identity.
- Easy-to-use API for executing queries and managing database connections.
Installation
Install the package using npm:
npm install azureidentity-mysql-db-connectorUsage
Here is an example of how to use the library:
const { connectToDatabase, executeQuery, closeConnection } = require('azureidentity-mysql-db-connector');
(async () => {
try {
await connectToDatabase();
const result = await executeQuery('SELECT * FROM your_table');
console.log(result);
} catch (error) {
console.error('Error:', error);
} finally {
await closeConnection();
}
})();API
connectToDatabase()
Establishes a connection to the MySQL database.
executeQuery(query: string)
Executes a SQL query and returns the result.
query: The SQL query string to execute.
closeConnection()
Closes the database connection.
License
This project is licensed under the MIT License. See the LICENSE file for details.
