Author Topic: Automated connection to database  (Read 3914 times)

0 Members and 1 Guest are viewing this topic.

huiz

  • Swamp Rat
  • Posts: 917
  • Certified Prof C3D
Automated connection to database
« on: May 03, 2011, 03:33:16 AM »
Is it possible in AutoCAD Map3D to create a connection to an Oracle database via .NET or Visual Lisp? (Or is that standard functionality I am not aware of?)

A client would like to have a button which will set the connection to his Oracle database so he doesn't have to fill in the connection form each time.

The conclusion is justified that the initialization of the development of critical subsystem optimizes the probability of success to the development of the technical behavior over a given period.

n.yuan

  • Bull Frog
  • Posts: 348
Re: Automated connection to database
« Reply #1 on: May 03, 2011, 10:01:25 AM »
Yes, you can have AutoCAD/AutoCAD Map connected to a database at its startup.

To connecta generic database, the key information is the ConnectionString. You do not really want to have AutoCAD actually connected to the database all the time. You just write code to let AutoCAD holds the ConnectionString, and only open the connection to a database with the ConnectionString when data access is needed (and close the connection as soon as the data accessing is done. The simplest way to do this would be to store ConnectionString related information in acad.exe.config file and write some code to read it when the code is loaded into AutoCAD.

However, I suspect that you are actually talking Acad Map 3D's FDO data connecting, usially done manually with "Data Connect" dialog. AutoCAD Map provides a set of API (included in Autodesk.Gis.Plugins.dll and AcMapDataConnectPlugins,dll) that allows you write a data Connect plugin to automate AutoCAD Map's connection to a FDO data source, be it Oracle, SQL Server, or whatever...

Actually, even with FDO data source, you still can use the first approach to open connection to the FDO source without having to build a data connection plugin.




Is it possible in AutoCAD Map3D to create a connection to an Oracle database via .NET or Visual Lisp? (Or is that standard functionality I am not aware of?)

A client would like to have a button which will set the connection to his Oracle database so he doesn't have to fill in the connection form each time.



huiz

  • Swamp Rat
  • Posts: 917
  • Certified Prof C3D
Re: Automated connection to database
« Reply #2 on: May 03, 2011, 03:59:52 PM »
Yes, you can have AutoCAD/AutoCAD Map connected to a database at its startup.

To connecta generic database, the key information is the ConnectionString. You do not really want to have AutoCAD actually connected to the database all the time. You just write code to let AutoCAD holds the ConnectionString, and only open the connection to a database with the ConnectionString when data access is needed (and close the connection as soon as the data accessing is done. The simplest way to do this would be to store ConnectionString related information in acad.exe.config file and write some code to read it when the code is loaded into AutoCAD.

However, I suspect that you are actually talking Acad Map 3D's FDO data connecting, usially done manually with "Data Connect" dialog. AutoCAD Map provides a set of API (included in Autodesk.Gis.Plugins.dll and AcMapDataConnectPlugins,dll) that allows you write a data Connect plugin to automate AutoCAD Map's connection to a FDO data source, be it Oracle, SQL Server, or whatever...

Actually, even with FDO data source, you still can use the first approach to open connection to the FDO source without having to build a data connection plugin.



Indeed I was talking about the FDO data connection. It is off course not effective to open a connection at the start of AutoCAD but it is more customer friendly to open the connection with one push on a button instead of filling in difficult user names and user passwords which are created by the oracle operator.

Thanks for your information and I will have a look at the API you mentioned! :)
The conclusion is justified that the initialization of the development of critical subsystem optimizes the probability of success to the development of the technical behavior over a given period.