How to Embed a SQL Server Database in an AutoCAD DLL?

How to Embed a SQL Server Database in an AutoCAD DLL?

emaguilera
Enthusiast Enthusiast
1,358 Views
4 Replies
Message 1 of 5

How to Embed a SQL Server Database in an AutoCAD DLL?

emaguilera
Enthusiast
Enthusiast

Hello everyone,

I'm currently developing a plugin for AutoCAD using .NET, and I need to embed a SQL Server database within the DLL file of my AutoCAD application. My goal is to ensure that the database is seamlessly integrated and accessible when the DLL is loaded.

Any code examples or detailed steps would be greatly appreciated. Thank you in advance for your help!

Best regards
Emanuel.

0 Likes
1,359 Views
4 Replies
Replies (4)
Message 2 of 5

Norman_Yuan
Mentor
Mentor

You cannot "Embed" SQL Server database in your DLL. MS SQL Server itself is a quite big service application itself, which can host/serve/manage many databases, while you could install it (sat the Express version) on each computer where your Acad app runs, it usually runs on a server computer of your office's intranet, or even from a remote host in the cloud. Your app can only access the database via the SQL Server. Further more, with current technology trend, letting client side app (your CAD app) to have direct access might not be a good practice, and your IT department may even not allow such direct access. Instead, the data served from SQL Server (or any database server) would be wrapped with service and exposed to end apps, most likely via HTTP(s) services.

 

Anyway, if your app need to access the data hosted by SQL Server, you DO NOT embed SQL Server with your CAD app DLL (not possible!). You use database access API, ADO.NET, basically, such as System.Data.SqlClient (Microsoft.Data.SqlClient, if you do Acad2025) in conjunction of other classes in System.Data.Xxxxx namespaces, if you do have access to a Sql Server running somewhere in your network, or even in your computer (then all your users have to go to your computer to get data!). You may need to learn some basic about how to set up database, assign permission to access... which are the knowledges/skills of another profession of database server administrator.

 

You can search the net/youtube for ADO.NET tutorial - there are tons of it.

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 3 of 5

daniel_cadext
Advisor
Advisor

With C++/ARX you can embed SQLite, I would search for SQLite bindings that do not required a provider.

Python for AutoCAD, Python wrappers for ARX https://github.com/CEXT-Dan/PyRx
0 Likes
Message 4 of 5

daniel_cadext
Advisor
Advisor

Also, there’s SQLite for AutoLisp here.

https://www.theswamp.org/index.php?topic=28286.0

in a pinch you can communicate with it through the lisp engine

Python for AutoCAD, Python wrappers for ARX https://github.com/CEXT-Dan/PyRx
0 Likes
Message 5 of 5

kerry_w_brown
Mentor
Mentor

I use SQLite DB bundled with the DLL's that use it. Can easily read and update the DB without replacing the Assembly . . .  but if your data is static that may not matter.

 

Regards,

 


// Called Kerry or kdub in my other life.

Everything will work just as you expect it to, unless your expectations are incorrect. ~ kdub
Sometimes the question is more important than the answer. ~ kdub

NZST UTC+12 : class keyThumper<T> : Lazy<T>;      another  Swamper
0 Likes