Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: bachristus on November 23, 2011, 08:57:44 pm

Title: Connection strings
Post by: bachristus on November 23, 2011, 08:57:44 pm
What should connection string look like to connect to repository by Repository.OpenFile() or Repository.OpenFile2()?

I tried to pass the connection strings generated in EA using DSN ("DSN=XXX;SERVER=YYY;UID=UUUU;PWD=pppp;DATABASE=dddd;PORT=3306") - and I get exceptions thrown.

Title: Re: Connection strings
Post by: Geert Bellekens on November 23, 2011, 09:21:38 pm
Best to create a "shortcut" eap file (use "Save As") and open that file with a text editor.

Geert
Title: Re: Connection strings
Post by: pha on November 23, 2011, 10:14:20 pm
The conn_string should be like:
Code: [Select]
Repository.OpenFile("C:\Test.EAP")To catch connection string of current project use:
Code: [Select]
Session.Output Repository.ConnectionString


Title: Re: Connection strings
Post by: bachristus on November 23, 2011, 11:21:10 pm
Quote
The conn_string should be like:
Code: [Select]
Repository.OpenFile("C:\Test.EAP")To catch connection string of current project use:
Code: [Select]
Session.Output Repository.ConnectionString



Excuse me but you just shortly repeated the API manual ::)

I need to connect to remote DB repository.
What I need is how to connect to repository not having DSN configured and .eap files created?
Title: Re: Connection strings
Post by: Geert Bellekens on November 23, 2011, 11:57:24 pm
Have you tried the "Save As" suggestion?

Geert
Title: Re: Connection strings
Post by: pha on November 23, 2011, 11:58:30 pm
Connection String to remote EA rep:
Code: [Select]
ea_sqlserver --- DBType=1;Connect=Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=ea_sqlserver;Data Source=ALM-SRV;LazyLoad=1;
Create on remote OS a *.UDL-file and specify type DBMS. Then open *.UDL-file with Notepad.
Probably it is necessary to add the database name before DBType=1.

The received conn_string can be used in a script with OpenFile() or OpenFile2().

I hope that I have understood you correctly :)
Title: Re: Connection strings
Post by: bachristus on November 24, 2011, 12:14:05 am
Quote
Have you tried the "Save As" suggestion?

Geert

Yes and it works. But... I need to connect to DB server without data source configured. It could be different DB and I have no access to the computer where my code should work. I have just server name, db name, credentials, port, db driver. Is there any way to open repository using just this info?
Title: Re: Connection strings
Post by: bachristus on November 24, 2011, 12:18:02 am
Quote
Connection String to remote EA rep:
Code: [Select]
ea_sqlserver --- DBType=1;Connect=Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=ea_sqlserver;Data Source=ALM-SRV;LazyLoad=1;
Create on remote OS a *.UDL-file and specify type DBMS. Then open *.UDL-file with Notepad.
Probably it is necessary to add the database name before DBType=1.

The received conn_string can be used in a script with OpenFile() or OpenFile2().

I hope that I have understood you correctly :)

"DBType=1" - what does it mean?
Title: Re: Connection strings
Post by: Geert Bellekens on November 24, 2011, 12:20:07 am
means SQL Server.
EA has a number for each type of supported database.

Geert
Title: Re: Connection strings
Post by: bachristus on November 24, 2011, 01:59:18 am
Is there any reference or manual on how to build this connection strings?

I just want to path the information which I was using to create DSN to some method, build proper connection string and get Repository.OpenFile() or OpenFile2() work.
Title: Re: Connection strings
Post by: qwerty on November 24, 2011, 11:32:21 pm
Google is your friend. That's what I found found out.

q.
Title: Re: Connection strings
Post by: bachristus on November 28, 2011, 09:25:46 pm
Could somebody provide the list of "DBType" values for each supported DB?
Title: Re: Connection strings
Post by: pha on November 28, 2011, 10:06:49 pm
I did not check. But it can be correct:

0 -- None
1 -- SQL Server
2 -- Oracle
3 -- MySQL
4 -- ODBC
Title: Re: Connection strings
Post by: Geert Bellekens on November 28, 2011, 10:40:03 pm
using the search button on the forum I got:
http://www.sparxsystems.com/cgi-bin/yabb/YaBB.cgi?num=1274978209/4#4

Geert
Title: Re: Connection strings
Post by: bachristus on November 28, 2011, 10:46:24 pm
Quote
using the search button on the forum I got:
http://www.sparxsystems.com/cgi-bin/yabb/YaBB.cgi?num=1274978209/4#4

Geert

For some reason this search button returned nothing to my "DBType" search  ;D

Thank you
Title: Re: Connection strings
Post by: pha on November 28, 2011, 10:48:31 pm
Really important information!
Thank you, Geert.
Title: Re: Connection strings
Post by: Geert Bellekens on November 28, 2011, 10:53:52 pm
Well, its kind-of a trick.
You have to use to top-left search button and not the top right search box.
Once there don't forget to change the "This post was made in the last..." to (all posts) because by default it will only search posts a week old.
(talking about a useless default!)

Geert
Title: Re: Connection strings
Post by: tomshanley on December 08, 2011, 12:16:26 pm
Thanks Geert - your post is prob the most useful thing I have read on this forum.  I've been using that search box for about a year, and not noticed that other search button.