Robert Cemper · May 9, 2018 go to post

is it persistent across different browsers ?

IF YES -> our problem,
OR do you see different cut off lengths.
 I especially distrust IE !
 

Robert Cemper · May 9, 2018 go to post

Eduard,

I googled around "max url lenght"  and found
#1 browser depending
#2 limit yourself to 2048 char.
So is your redirect just URL or  URL?urlparams=...... 

Robert Cemper · May 9, 2018 go to post

I added it just to the end. But thas nit important.

Did you also add at the end this: ??

Storage GSQLStorage
{
<StreamLocation>^
Mike.StreamS</StreamLocation>
<Type>%CacheSQLStorage</Type>
}

If this is missing the class also doesn't compile. 
the name of the global for streams is not important.

BT: What error did you get ?

Robert Cemper · May 9, 2018 go to post

- you have

Parameter CONNECTION = "canreg,NOCREATE";

- so the name of your Gateway definition is canreg 
- you have no storage for streams defined.
Strange but might be an issue of Caché version version issue.
in 2016.2 it just doesn't compile without.
- more strange is this:

Index MainIndex On null [ IdKeyPrimaryKey ];

The property null doesn't exist in your class.
Without a property null  it doesn't compile for me.

adding manually the missing Storage section and 

Property null As %Integer;

let it compile for me. 

Though this may be a temporary fix I distrust your Link Wizard.
Eventually, you should contact WRC  to investigate the reason.

Robert Cemper · May 8, 2018 go to post

You are right!  
And I'm not aware of a different behavior.  Except:  oops!

Robert Cemper · May 8, 2018 go to post

I just can guess for possible reasons
- dependencies in parallel compiling 
- some kind of complex or circular "CompileAfter" constructs 

those things often vanish at 2nd compile with freshly loaded classes.  (Hard to reproduce.)

Robert Cemper · May 7, 2018 go to post

I finally got the code to compile with no errors.
When I run it, the code will insert a row in the table "global" in 
cache.
However, it isn't inserting the information in the external database.

From what you describe you have generated a Local Table
as there is a GLOBAL and you write to your local DB. As you have seen.

If you use Link Table Wizzard to create it, then there is just no global.
The correctly generated class looks similar to this:

/// Generated by the Link Table wizard on 2018-05-07 23:20:46.
Note that you can access the data in this class only when the external database is accessible
.

Class GTY.Person Extends %Library.Persistent [. . . . , StorageStrategy = GSQLStorage ]
{
/// Specifies details for the SQL Gateway Connection that this class uses
Parameter CONNECTION = "
. . . . . . ,NOCREATE";
.......

Storage GSQLStorage
{
<StreamLocation>^
####S</StreamLocation>
<Type>%CacheSQLStorage</Type>
}

}

If you do not see the bolded text in your class,
it is not generated by Link Table Wizard and
you are in the wrong Class / Table with no access to he external table.

Robert Cemper · May 7, 2018 go to post

only 1 .int in %SYS uses "oops:"
MIRRORCOMM.int(2845): if $zb(+$SYSTEM.Mirror.DebugFlags(),1,1) do $zu(9,"","oops: jrn.log has incorrect entry, exp("_newpath_") logentry("_jrnfname_"), file num-"_mirfilecnt)
 

 could be an indicator to some MIRROR issue

Robert Cemper · May 7, 2018 go to post

Could it be there was some Tune Table running that saves its statistic in Storage part of Class ?

BTW. oops is really new style surprise

Robert Cemper · May 7, 2018 go to post

2 steps:

  • create the new table EMS.BASIC
  • INSERT INTO EMS.BASIC (Name,DOB,Gender) Select Name,DOB,Gender from EMS.EMS
Robert Cemper · May 7, 2018 go to post

There is a bunch of useful articles you find here searching for CSV.

I just picked one out of them: 
https://community.intersystems.com/post/how-read-csv-file-contents-objects-cache

In a Windows environment, you may also use an ODBC driver (DSN) and handle
Excel as what it is: As a Table using the SQLgateway as you would to with other DBs

You just have to take care to get the bits matching  (32/64). More details:
https://support.office.com/en-us/article/overview-of-connecting-to-importing-data-c0ad7aec-ff1a-4e48-9c21-dc18a102433f
 

Robert Cemper · May 4, 2018 go to post

Yes.  Connect to Mirror using SQLgateway.
Link Procedure And then just to a SELECT or CALL.
The code has, of course, to be prepared already on Mirror.

Robert Cemper · May 3, 2018 go to post

as Jeff mentioned: the Shadowed DB is Read Only.

Execution of some code in a remote instance of Caché is independent of Mirror or not

  • Either pack your code (or its call) into a ClassMethod with a return value.
    mark the Method as  [SqlProc ]
    trigger it by SELECT my.procedure()
  • Or wrap it into some WebService ( REST, SOAP) and execute it that way. 
Robert Cemper · May 3, 2018 go to post

if ever this should be of practical use
then I'd suggest to move such a "everybody's darling" routine to %SYS and name it %zYJM

Robert Cemper · May 3, 2018 go to post

I agree and have suffered over years.
I think for Caché and its  derivates it's somewhat late in the life cycle.
Eventually with iris ?  Should be worth an enhancement request

Robert Cemper · May 1, 2018 go to post

Great!

SAMPLES>w !! do $system.OBJ.ExportUDL("Sample.Company.cls")


/// This sample persistent class represents a company.<br>
Class Sample.Company Extends (%Persistent, %Populate, %XML.Adaptor)
{

/// Define an index for <property>Name</property>.
Index NameIdx On Name [ Type = index ];

/// Define a unique index for <property>TaxID</property>.
Index TaxIDIdx On TaxID [ Type = index, Unique ];

/// The company's name.
Property Name As %String(MAXLEN = 80, POPSPEC = "Company()") [ Required ];

/// The company's mission statement.
Property Mission As %String(MAXLEN = 200, POPSPEC = "Mission()");

/// The unique Tax ID number for the company.
Property TaxID As %String [ Required ];

/// The last reported revenue for the company.
Property Revenue As %Integer;

/// The <class>Employee</class> objects associated with this <class>Company</class>.
Relationship Employees As Employee [ Cardinality = many, Inverse = Company ];

------<skip rest> -------

Robert Cemper · Apr 30, 2018 go to post

Thank you Tim!

You finally gave me a hint why to use  [ ProcedureBlock = 0]   or [PublicList = (x1, x2) ]
as a Method_Parameter.  I never saw serious reasons for it.

Robert Cemper · Apr 27, 2018 go to post

no need to excuse.
the wording (and help text) sometimes not really guiding.
but you motivated me to use more screenshot for explanations.
 

Robert Cemper · Apr 27, 2018 go to post

you remind me the joke about hieroglyphs:
-  What's wrong with them?
- Nothing! Priests in old Egypt were reading the "book of death" like you would read a newspaper.
- You just have to learn the 'encryption'.

Robert Cemper · Apr 27, 2018 go to post

Thanks for the clarification.
It's sometimes hard to guess the picture if you miss some pixels.

I'd still recommend moving the CLOSE after each inner loop to have OPEN / CLOSE strictly paired

The implicit CLOSE happens only if you exit the partition. There's no class to act undercover. 
Curly braces just structure the code with no operational side effect.

Robert Cemper · Apr 27, 2018 go to post

It seems you have manually changed the class definition.

A normal RegisterdObject has no storage definition.
from <Type>%Library.CacheStorage</Type> i see it was a %Rersitent before.

Storage Default
{
<Data name="EOBListDefaultData">
<Subscript>"EOBList"</Subscript>
<Value name="1">
<Value>EOBList</Value>
</Value>
</Data>
<DefaultData>EOBListDefaultData</DefaultData>
<Type>%Library.CacheStorage</Type>
}

remove Storage and recompile.

Robert Cemper · Apr 26, 2018 go to post

I finally succeeded in reproducing your error

ERROR #5803: Failed to acquire exclusive lock on instance of '%Studio.ProjectItem'

The conditions are somewhat strange and you should take an exact check what applies in your case.
The story:

  • ENSEMBLE uses %Studio.Project to manage the export.
  • every item to be exported gets locked. The global  name to look for is ^oddPROJECT
  • if the number of items exceeds a threshold the whole Project storage will be locked
  • this is NOT possible if someone else has any other project in this namespace locked for him
    then the export will fail and you get the ERROR message. 

So try to find out in Terminal

  • USER>zn "%SYS"
    %SYS>write $system.SQL.GetLockThreshold()      ; most likely default => 1000

    xxxxxx
  • %SYS>d ^LOCKTAB
                       LOCK table entries at
                    16767728 bytes usable, 16774528 bytes available.
    Entry Process     X#   S#
    Flg   W# Item Locked
       1) 1016         1               ^["^^c:\intersystems\17e20\mgr\"]%SYS("CSP","Daemon")
       2) 6444         1               ^["^^c:\intersystems\17e20\mgr\"]ISC.LMFMON("License Monitor")
       3) 6752         1               ^["^^c:\intersystems\17e20\mgr\"]ISC.Monitor.System
       4) 12180        1               ^["^^c:\intersystems\17e20\mgr\"]TASKMGR
       5) 8568         1               ^["^^c:\intersystems\17e20\mgr\user\"]
    oddPROJECT("Ali")
     
    Command=>

Look if you see oddPROJECT

Next try to estimate the number of items your production will export.
If you get close to the dimension of  xxxxxx then you run most likely into your error.
Be aware that some components can create more than 1 entry. So your limit might be lower (70% ??)

You can increase the threshold in
MgmtPortal > System Admin > Configuration > SQL and Object Settings > General SQL Settings

ATTENTION:  If you set this value to high you risk an overrun of the LOCKTABLE.
        This blocks the whole instance.   Increasing the size of LOCKTABLE + Restart is then required. Or you set the limit t back.

Robert Cemper · Apr 26, 2018 go to post

I miss 3 things in this example:

  • There is a condition: I found no IF nor anything
  • at the end of the inner loop there is no CLOSE file1 7 /  CLOSE file2  for file1 or file2
  • OPEN file:("WNS": ......)   
    • W - Write is ok
    • S - Stream mode is OK
    • N - i s questionable. if you are not on VMS you override the file at each outer loop
      http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=GIOD_rmsseqfiles#GIOD_rmsseqfiles_use
      New file. If the specified file does not exist, the system creates the file. If the specified file already exists, the system creates a new one with the same name. The status of the old file depends on which operating system you are using. On UNIX® and Windows, Caché deletes the old file. (Note that file locking should be used to prevent two concurrent processes using this parameter from overwriting the same file.)

      So to get all output you may append arrayIndex to filename to have unique file names

Robert Cemper · Apr 26, 2018 go to post

as you noted SEEMS not to work.

method OnInit() as %Status

This user callback method is called via initConfig() from %OnNew() or in the case of SOAP Services from OnPreSOAP()

 $$$LOGINFO("INIT") translates to
   Do ##class(Ens.Util.Log).LogInfo($$$CurrentClass,$$$CurrentMethod,"INIT")

I'd suggest to replace it by set ^Antonio($i(^Antonio))=$lb($ZDT($h,3),"INIT")

so so find out if your Init gets called or not or multiple times, .. 
Especially during init phase high independence from the rest could be useful

Robert Cemper · Apr 26, 2018 go to post

My final idea:
- restart the whole ENSEMBLE instance to get rid of anything that might be hidden/hanging around in memory.
     It's not my preferred solution, but with the actual information, nothing else seems to work.
     If someone starts screaming you may have identified you opponent that blocks you. 
- if the problem persists further then contact WRC