Author Topic: Project Transfer automation details  (Read 12177 times)

mrt2100

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Project Transfer automation details
« on: January 08, 2019, 04:31:06 am »
Hello everyone, first time poster here. TL;DR below if you like.

I'm super new to Sparx, and I'm attempting to take automation for project transfers from inside EA to outside EA (so it can be scheduled instead of manual).  I've scoured these forums and came across a suggested powershell method here:

https://sparxsystems.com/forums/smf/index.php/topic,2708.0.html

This is awesome!  Love me some powershell.  And I'm rather sure this is the correct syntax to do what I want to do.  Though, I'm having lots of trouble trying to transfer the project to a file.

First I execute the script and I get a popup stating:

"Source database must be at least version 3.50. Please upgrade source first, then try again."

Checking another forum suggestion I looked at the %APPDATA%...DBError.txt file and see this:

"Transmission error communicating with server.

The server name or address could not be resolved"

So I am assuming that my issue is with the source string.

I have a cloud connection string that I copied from a saved model shortcut on my desktop, and use this as my source string.  I've added other parameters from the powershell suggestion that I thought were appropriate, but I'm simply not able to connect to the server with this string using automation.  FYI, yes I am under a corporate firewall.

So finally my question is: what is the difference in connection string structures between the application transferring the model vs automation?  Could I be missing something in the string to make it connect? Why would automation running within the application work (ie projectTransfer works within the application), but parallel logic outside of the application does not?


TL;DR - How do you transfer a project from a model in our cloud?  What the difference in connection strings between the EA application vs automation?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Project Transfer automation details
« Reply #1 on: January 08, 2019, 05:05:52 am »
You should be fine if you open the Open dialog in EA and from the context menu of a repo check out Edit Connection String.

q.

mrt2100

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Re: Project Transfer automation details
« Reply #2 on: January 08, 2019, 05:37:56 am »
I agree that this is the correct way for me to get my connection string.  Though digging deeper, I'm looking to avoid the "Source must be 3.50" popup and the Project Transfer popup that I am forced to click through.  Is there a way to avoid these popups with arguments?

I had thought that the 3.5 message referred to the Jet version, though I do not have Jet 4 checked in the application.  Maybe I'm not importing a particular dll or module?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Project Transfer automation details
« Reply #3 on: January 08, 2019, 06:26:49 am »
That popup can not be suppressed. However, you should check your configuration that you all use Jet4 (or 3.5 if you prefer) and you don't have a mix.

q.

mrt2100

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Re: Project Transfer automation details
« Reply #4 on: January 08, 2019, 06:30:57 am »
Ah, that is disheartening :(

Thank you though, I appreciate your answers qwerty.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Project Transfer automation details
« Reply #5 on: January 08, 2019, 08:02:21 am »
When I look again at the details I see
Quote
"Transmission error communicating with server.

The server name or address could not be resolved"
So I'd guess the issue is with the server. Where is your host located and kind of DB is it?

q.

mrt2100

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Re: Project Transfer automation details
« Reply #6 on: January 10, 2019, 02:45:22 am »
I'm being told a guess that it's an Oracle database within our firewall.  I'm waiting on some confirmation but let's go with that for now.

mrt2100

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Re: Project Transfer automation details
« Reply #7 on: January 10, 2019, 03:09:55 am »
I've confirmed we have a MySQL database (DBType=0) so this is what I'll use in my string.

For further debugging, I'm digging into an error from powershell that states this:

"
Exception calling "ProjectTransfer" with "3" argument(s): "The server threw an exception.
(Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT))
+ $project.ProjectTransfer("$sourceFilePath", "$targetFilePath", "$transferLog")
"

According to the API documentation here,
https://sparxsystems.com/enterprise_architect_user_guide/12.1/automation_and_scripting/project_2.html
...it says there are supposed to be 3 arguments.  I'll dig around more and see what I can find, maybe it's something deeper.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Project Transfer automation details
« Reply #8 on: January 10, 2019, 03:34:31 am »
Maybe if you post the code snippet someone might have an idea.

q.

mrt2100

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Re: Project Transfer automation details
« Reply #9 on: January 10, 2019, 03:50:06 am »
All these years coding and I forget to do that first :P

Further reading about the error I posted suggests that I have a COM object issue.  When I attempt to call projectTransfer is where the error gets thrown.

This is the first I've had to learn about this so here we go!

Snippet with appropriate stuff removed of course.

Code: [Select]
# Create the EA object
$ea = New-Object -ComObject "EA.Repository" -Strict

# Get the project interface
write-host $ea.ConnectionString
write-host "Getting project interface"
$project = $ea.GetProjectInterface()

$sourceFilePath = "MyName --- DBType=0;Connect=Cloud=protocol:https,address:<address within firewall>,port:443;Data Source=<DS>;DSN=<DSN>;LazyLoad=1;"

write-host "sourceFilePath: $sourceFilePath"

$targetFilePath = "<path to file>-test.eap"
$transferLog    = "<path to file>LogFile.txt"

write-host "Transferring project"
$project.ProjectTransfer("$sourceFilePath", "$targetFilePath", "$transferLog")

write-host "Transfer complete."
ii (get-item $targetFilePath).Directory
# Close the session and exit
$ea.Exit()


qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Project Transfer automation details
« Reply #10 on: January 10, 2019, 04:01:16 am »
Can you open the source by using that manually in EA (edit connection string)?

q.

mrt2100

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Re: Project Transfer automation details
« Reply #11 on: January 10, 2019, 06:18:41 am »
I have not tried that with my own string, within EA itself.  I will give that a shot.

Though, the script I'm cannibalizing code from has an even simpler source string:

This code is Jscript
Code: [Select]
var intakeSource = "Enterprise Architect on <ORG> Cloud --- ;Connect=Cloud=protocol:https,address:<org address>,port:443;Data Source=<DS>;DSN=<DSN>"

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Project Transfer automation details
« Reply #12 on: January 10, 2019, 07:00:54 am »
Uhm. Now I notice that cloud connection. Probably you'll have to contact Sparx support. I don't know it, but read quite a number of "why does it not work/what should I do to..." questions here.

q.

mrt2100

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Re: Project Transfer automation details
« Reply #13 on: January 10, 2019, 07:09:19 am »
That's what I keep running into also today :( Looks like that's what I'll be doing while looking for other workarounds.

Thanks qwerty, I appreciate your answers and glad this forum isn't super dead :)

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8068
  • Karma: +118/-20
    • View Profile
Re: Project Transfer automation details
« Reply #14 on: January 11, 2019, 09:18:47 am »
Uhm. Now I notice that cloud connection. Probably you'll have to contact Sparx support. I don't know it, but read quite a number of "why does it not work/what should I do to..." questions here.

q.
Unless I'm mistaken, you can't do a db transfer using a cloud connection even using the GUI.