Author Topic: Connection strings  (Read 18112 times)

bachristus

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
Connection strings
« 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.


Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13387
  • Karma: +564/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Connection strings
« Reply #1 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

pha

  • EA User
  • **
  • Posts: 39
  • Karma: +0/-0
    • View Profile
Re: Connection strings
« Reply #2 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


« Last Edit: November 23, 2011, 10:16:19 pm by 666999 »

bachristus

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
Re: Connection strings
« Reply #3 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?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13387
  • Karma: +564/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Connection strings
« Reply #4 on: November 23, 2011, 11:57:24 pm »
Have you tried the "Save As" suggestion?

Geert

pha

  • EA User
  • **
  • Posts: 39
  • Karma: +0/-0
    • View Profile
Re: Connection strings
« Reply #5 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 :)

bachristus

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
Re: Connection strings
« Reply #6 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?

bachristus

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
Re: Connection strings
« Reply #7 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?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13387
  • Karma: +564/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Connection strings
« Reply #8 on: November 24, 2011, 12:20:07 am »
means SQL Server.
EA has a number for each type of supported database.

Geert

bachristus

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
Re: Connection strings
« Reply #9 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.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Connection strings
« Reply #10 on: November 24, 2011, 11:32:21 pm »
Google is your friend. That's what I found found out.

q.

bachristus

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
Re: Connection strings
« Reply #11 on: November 28, 2011, 09:25:46 pm »
Could somebody provide the list of "DBType" values for each supported DB?

pha

  • EA User
  • **
  • Posts: 39
  • Karma: +0/-0
    • View Profile
Re: Connection strings
« Reply #12 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

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13387
  • Karma: +564/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Connection strings
« Reply #13 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

bachristus

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
Re: Connection strings
« Reply #14 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
« Last Edit: November 28, 2011, 10:49:49 pm by bachristus »