Hello Pritam Chanda,
Welcome to the Microsoft Q&A and thank you for posting your questions here.
Problem
I understand that you are having challenges to connect your ARM64 platform to SQL Edge container using sqlcmd tool.
Solution
The sqlcmd
tool is indeed not available for ARM64 platforms, which poses a challenge when you need to interact with SQL Edge on such devices. However, there are alternative methods to connect to and manage your SQL Edge instance on an ARM64 platform like the NVIDIA Jetson Orin Nano board.
The simplest way, you can run sqlcmd
from another machine (such as a Windows, Linux, or macOS machine) that is not ARM64. This machine can be on the same network as your Jetson Orin Nano board. You would connect remotely to your SQL Edge instance running on the ARM64 device.
Using the typical example of this command: sqlcmd -S <Jetson_IP_Address>,<Port> -U SA -P '<YourPassword>'
You can run SQL queries directly from within the Docker container using the docker exec
command. This method involves running SQL scripts or queries directly inside the container by using this example code: docker exec -it <container_name> /bin/bash -c "echo 'SELECT * FROM your_table' | /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P '<YourPassword>'"
Most common for IoT Developers is to use programming languages like Python with appropriate libraries (e.g., pyodbc
or pymssql
) to connect to your SQL Edge instance and run queries. This can be done either from another machine or directly on the ARM64 device if the libraries support ARM64.
An example of your Python script will be similar to:
import pyodbc
connection = pyodbc.connect('DRIVER={ODBC Driver 17 for SQL Server};SERVER=<Jetson_IP_Address>,<Port>;UID=SA;PWD=<YourPassword>')
cursor = connection.cursor()
cursor.execute("SELECT * FROM your_table")
for row in cursor:
print(row)
Also, if SQL Edge supports REST API, you can use HTTP requests to interact with your database. This method is not common but can be useful in certain scenarios.
Lastly, you can use graphical tools like Azure Data Studio or SQL Server Management Studio (SSMS) on another machine to connect to your SQL Edge instance. These tools provide a rich interface for managing SQL databases.
References
For more reading, step-by-steps and information for the above alternatives, kindly use the below links and the additional resources available by the right side of this page.
Source: Use SQLCMD from Another Machine. Accessed, 6/20/2024.
Source: Use Azure Data Studio or SQL Server Management Studio (SSMS). Accessed, 6/20/2024.
Source: Use Docker Exec to Run SQL Queries. Accessed, 6/20/2024.
Source: Using Python or Other Programming Languages. Accessed, 6/20/2024.
Source: Azure SQL Edge Documentation. Accessed, 6/20/2024.
Accept Answer
I hope this is helpful! Do not hesitate to let me know if you have any other questions.
** Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful ** so that others in the community facing similar issues can easily find the solution.
Best Regards,
Sina Salam