Archicad C++ API
About Archicad add-on development using the C++ API.

DSN Less ODBC Connection

Anonymous
Not applicable
Hello All
Is it possible to connect the AC ODBC dsn-less? Does anyone have an example or suggest a resource?
Many thanks
Mark
6 REPLIES 6
Karl Ottenstein
Moderator
image_engine wrote:
Hello All
Is it possible to connect the AC ODBC dsn-less?
Not to my knowledge.

Karl
One of the forum moderators
AC 27 USA and earlier   •   macOS Ventura 13.6.6, MacBook Pro M2 Max 12CPU/30GPU cores, 32GB
Anonymous
Not applicable
Thanks Karl
Makes it pretty messy with large number of projects without programatic access.
Regs
Mark
Karl Ottenstein
Moderator
image_engine wrote:
Thanks Karl
Makes it pretty messy with large number of projects without programatic access.
Regs
Mark
You're welcome; and I agree.

I just did a Google on 'programmatic system dsn' and among other things came up with this:
http://www.databasejournal.com/features/mssql/article.php/1491051

and the registry hack seems like a potentially reasonable work around.

On my XP Pro system, the system DSN entries are found at:
\HKLM\Software\ODBC\ODBC.INI\

Screenshot below shows the contents of an old DSN called "ODBC test" from the AC 9 version of the driver. Note that the key "ODBC Data Sources" must also contain a link (index) to point to this entry.

Maybe this will work? Report back here if so to help the next guy...

Thanks,
Karl
odbc-reg.gif
One of the forum moderators
AC 27 USA and earlier   •   macOS Ventura 13.6.6, MacBook Pro M2 Max 12CPU/30GPU cores, 32GB
Anonymous
Not applicable
Hi Karl
Got it sorted but I'm just in the office...those typos!!. You can do a standard dsn less connection...its just that I copied the connection string example from the help file which is "V1.0" not "V10.0" and so it went under the radar for a little while.
This codes works well for auto dsn generation when attached to the form open command;

http://www.vbforums.com/showthread.php?t=358864

and its quite terse. I discovered also that there is direct registry editing throught the getsettings of vba. More than one way to skin an archicat!
Standard ADO with connection string is by far the best alternative though.
Regs
Mark
Karl Ottenstein
Moderator
image_engine wrote:
Standard ADO with connection string is by far the best alternative though.
Are you saying that standard ADO does work, Mark? (Or that that would be your wish?) That would be great, as it is how I usually do things in VB in Access...

Thanks,
Karl
One of the forum moderators
AC 27 USA and earlier   •   macOS Ventura 13.6.6, MacBook Pro M2 Max 12CPU/30GPU cores, 32GB
Anonymous
Not applicable
Hi Karl
Seems to be working fine. Just working on some timestamping but I get
State = adStateOpen on conn open.
Regs
Mark