Hi Sunraj sharma •,
Welcome to Microsoft Q&A forum and thanks for using Azure Services.
As I understand, you want to Connect to Azure SQL Edge (local docker instance) from another network machine.
I assume you are following the steps as below:
You might want to connect to the instance of Azure SQL Edge from another machine on the network. To do so, use the IP address of the Docker host and the host port to which the Azure SQL Edge container is mapped. For example, if the IP address of the Docker host is 192.168.2.121
, and the Azure SQL Edge container is mapped to host port 1600, then the server address for the instance of Azure SQL Edge would be 192.168.2.121,1600
. The updated Python script is:
import pyodbc
server = '192.168.2.121,1600' # Replace this with the actual name or IP address of your SQL Edge Docker container
username = 'sa' # SQL Server username
password = 'MyStrongestP@ssword' # Replace this with the actual SA password from your deployment
database = 'MyEdgeDatabase' # Replace this with the actual database name from your deployment. If you do not have a database created, you can use Master database.
db_connection_string = "Driver={ODBC Driver 17 for SQL Server};Server=" + server + ";Database=" + database + ";UID=" + username + ";PWD=" + password + ";"
conn = pyodbc.connect(db_connection_string, autocommit=True)
Let us know if above steps are performed fine at your end.
Thanks