Book a Demo

Author Topic: Automation Repository SQL Database  (Read 2989 times)

bgoring

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Automation Repository SQL Database
« on: January 08, 2007, 07:05:17 am »
Using VB 6.0 in conjunction with the Automation interfaces.

I would like to open a Repository that is maintained in sql server database, as opposed to from a file. The supporting method for file is

EARepository.OpenFile( <eap filename> )

Anyone know if its possible to open a database from VB?

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Automation Repository SQL Database
« Reply #1 on: January 08, 2007, 07:30:18 am »
The simple answer is "Yes."

What you need to do - this is buried in the documentation - is to use a connection string instead of a file name. What is not well documented is just which connection string you need to use.

EA expects the same connection that it would set up on its own. When you connect to a repository the first time, EA will walk you through some standard Windows dialogs to connect to a data source, which you will need to create on your system. During this process, EA builds a connection string. If you exit and restart EA, you will usually see this connection string in the File menu - it is most likely in position 2.

Here's the part that everyone trips over. You must provide the connection string in exactly the format you see in the File menu. EA prefixes the string with the name you gave your model, followed by (I think, but check this yourself) a space, three dashes, and another space. The rest of the string is exactly what you'd expect from the Windows data connection dialogs mentioned above. You need to provide the whole thing, including the model name and the punctuation. Once you get this right, EA will do just what you want. It happens so quickly - and so cleanly - that you'll likely think nothing happened.

You can open and save the repository model to the desktop. This creates an icon that puts the connection string in the target, which you can then copy. Search the forum for how to do this if it doesn't work the first time.

One more thing. Using VB (any version) be careful to handle embedded double quotes correctly when you first grab or copy the string.

David
No, you can't have it!

dkl

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: Automation Repository SQL Database
« Reply #2 on: February 22, 2007, 08:20:27 am »
Well, but what if I need to open the repository from my Custom Tool? What should I set as command line arguments?

"$f"

works well for files, but in case of database it returns only bare connection string, without EA prefixes.
Koupil jsem si francovku,
dal jsem za ní 30 korun,
teď ji vozkusím
jestli je lepší než rum.

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Automation Repository SQL Database
« Reply #3 on: February 22, 2007, 10:45:53 am »
Search the forum for messages by me that contain the phrase "Connection String." [Without the punctuation]
No, you can't have it!