Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: pablo.emanuel on February 18, 2004, 03:43:28 pm

Title: Opening SQL database via Automation
Post by: pablo.emanuel on February 18, 2004, 03:43:28 pm
Hi all,

I've started to use the Automation Interface (v. 3.60), and , by browsing through the docs and experimenting, I've managed to do pretty much everything I needed, as long as the database I'm working on is on an EAP file. I couldn't find anywhere in the docs, and the naïve attempts I made failed, how to connect to a SQL Server database using the EA.Repository interface. I tried to use EA.Repository.OpenFile, passing the connection string (as it shows in the Open project dialog in EA) as parameter instead of the file path, but it just didn't work.

Thanks in advance for any clue,

Pablo
Title: Re: Opening SQL database via Automation
Post by: Jon on February 24, 2004, 07:49:58 am
It does work, but...  I've found empirically that you need to use the whole connection string - including the description part.  (EA seems to use "<description> --- <connection string>").  So you get something like this:
"My Model --- DBType=1;Connect=Provider=SQLOLEDB.1;Password=pass;Persist Security Info=True;User ID=fjd;Initial Catalog=EAModel;Data Source=servername.domain.com"

When I use the whole of this, it works ok for me.  (I'm using Build 660.)

Hope this helps!

Cheers
Jon