Samuel Fitzsimmons
Samuel Fitzsimmons

Reputation: 1

MUMPS DB export to MYSQL

I have access to a MUMPS DB via DATABASE.MSM file, and need to export the data. It runs via an MSM.exe, but other than that, I am unable to access the data. How would I go about getting this data exported?

I've tried finding credentials, but since it's an old system that we've had for a very long time, we can't find anything.

Upvotes: 0

Views: 82

Answers (1)

ECB-RS-BR
ECB-RS-BR

Reputation: 1

I don't know the resources of this msm.exe that you have access to. I normally access it through the terminal and, in my case, I can also access it through MSM Workstation (as it is a Micronetics System Mumps). Do you have access to developing routines using the M language? If you have access, you can create routines that extract data from globals and insert them into SQL tables.

________________Routine Label to open SQL Connection________________
opensql S $ZT="ERROC"
    S SQLOK=0
    S %connection="Provider=SQLOLEDB;Server=192.1.1.1;Database=YourDBName;Uid=YourUser;Password=Password"
    ZSET %database=$ZCREATEOBJECT("ADODB.Connection")
    I $ZOBJREF(%database)=0 D  Q
    . S SQLOK=0
    S %database.ConnectionTimeout=10
    S %database.CommandTimeout=300
    D %v.Open(%connection)
    S SQLOK=1
    Q

________________Routine Label to close SQL Connection________________
closesql    
    S $ZT="ERROD"
    Q:'$d(%database)
    I %database.state'=0 d
    . D %database.Close
    K %database,SQLOK,%connection
    Q

________________Routine Label to run Insert________________
instru(table,data)  
    ZSET rst=%database.Execute("INSERT INTO "_table_" VALUES("_dada_")")
    Q

After that you need to open a connection, run inside a loop a data extraction to your Insert into sql and after finish all the loop, close the connection...

    D opensql
    ;...create a loop taking the data and inserting...
    . D instru("TableName",$G(^|"YourUCI,YourVG"|YourGlobal(indexKey1,indexKey2,etc))
    D closesql

Upvotes: 0

Related Questions