Robert Cemper · Mar 3, 2022 go to post

from session use the SQL Shell

PROMPT>do $system.SQL.Shell()
SQL Command Line Shell
----------------------------------------------------
The command prefix is currently set to: <<nothing>>.
Enter <command>, 'q' to quit, '?' for help.
[SQL]PROMT>>SELECT whatever single line SQL

or


PROMPT>do $system.SQL.Shell()
SQL Command Line Shell
----------------------------------------------------
 
The command prefix is currently set to: <<nothing>>.
Enter <command>, 'q' to quit, '?' for help.
[SQL]PROMPT>>  << entering multiline statement mode, 'GO' to execute >>
        1>>
Robert Cemper · Mar 1, 2022 go to post

you should check a few things upfront
- is your Caché a 64 bits installation and is the   pythonbind3.c  also compiled for 64 bit   (or both 32bit)
  this might be one possible reason for the "data mismatch" you mention
- pythonbind3.c seems to be a C code using the Callin Interface.
  this requires Service %Service_CallIn to be enabled with user, passwd, ...
- next check the SuperServer Port (default = 1972)
- connect to a USER namespace. Since %SYS requires rather high privileges.
- then check if the connection really works.
  once established it should be possible to identify the related process from
  System Management Portal / Operations / Processes showing the client_exe, namespace, ...
- then you may start composing queries.
 

Robert Cemper · Feb 28, 2022 go to post

it is in Namespace %SYS
Class %CSP.UI.Portal.EnsembleMonitor

if you use a class name starting with %Z* you can even have it in %SYS
 

Robert Cemper · Feb 28, 2022 go to post

A little bit of guessing from my side. behind your page /csp/test/person.csp
there is a namespace  (eg. USER)  with DB user 
If you have no login page you run as "UnknownUser" 
If it has no access rights or appropriate roles (most likely) for this DB behind you are lost;

2 possible workarounds: 

  1. give "UnknownUser"  enough rights for this Namespace and/or DB. 
    • but this is then valid not just to this specific CSP page
    • not really recommendable
  2. create a new user with the required rights
    • on your CSP page you can assign this user undercover by method
    • %CSP.Session.Login() and you have PW under control
    • no need  to touch "UnknownUser"
Robert Cemper · Feb 28, 2022 go to post

Congratulations to all paticípants  and
Thanks for your efforts to provide public examples for the new technology.

Robert Cemper · Feb 28, 2022 go to post

with CSP you have a license user that can be changed by %CSP.Session.Login()

Login with this username and password, returns a status code to show if it worked or not. This method also trades license units at the same time so this CSP session will be logged in as a named user. If you pass type=1 then this will trade licenses only and not login as this user. After the login completes it also updates the property Username to match the $username value this session is logged in as. The property LicenseId is also updated to be the license identifier that this session is logged in with.
If a login fails then the property Username and property LicenseId will remain at their previous values. If you pass oldpassword then this will attempt to change the password of username from oldpassword to password and login as this user. Note new status return values: CSP applications can be two-factor-enabled. If the current application is one such, then if Login() successfully authenticates the username/password, it does not return $$$OK, but rather $$$CSPPendingTwoFactorAuthentication. During Two-Factor Authentication, an 8-character numeric security string will be sent to the user's cellphone. You must obtain this string from the user and call CompleteTwoFactorLogin^%CSP.Session() to complete authentication of this user. Also note that if the login SUCCEEDS (status returned will be $$$OK), but you were unable to secure a license, the new apperr parameter will have the value of $$$CSPErrorTradeLicense. In such a case, you may have to call the Login function again to trade a license. If you are calling merely to trade a license (type=1), then if the license trade fails, Login will return a status of $$$CSPErrorTradeLicense.

Robert Cemper · Feb 27, 2022 go to post

Version is not the reason. It is %JSON Adaptor that breaks it. 
Removing it let it compile.  Just tried it with 2022.1 preview
I suggest you deposit a bug report at WRC. Either compiler od Doc is wrong

Robert Cemper · Feb 27, 2022 go to post

You reference the documentation  for 

but your $ZV shows.

$ZV: IRIS for Windows (x86-64) 2021.1 (Build 215U) Wed Jun 9 2021 09:39:22 EDT [Health:3.3.0]
this might be the reason !

The difference is significant.

Robert Cemper · Feb 26, 2022 go to post

detailed description is here  Defining an XData Mapping Block

  XData {MappingName}
  {
    <Mapping  {ClassAttribute}="value" [...] xmlns="http://www.intersystems.com/jsonmapping".>
      <{Property Name}="PropertyName" {PropertyAttribute}="value" [...] />
      [... more Property elements]
    </Mapping>
  }
Robert Cemper · Feb 26, 2022 go to post

Just checked.  The method  uses %XML.Reader=##class(%XML.Reader).%New()
So you better  compose a nice XML description.
this tells you what is expected:

Do reader.CorrelateRoot("%JSON.Mapping")
 

Robert Cemper · Feb 26, 2022 go to post

And that's the description
classmethod GenerateMappingFromXdata(class As %String, ByRef mapping) as %Status

Get the JSON adaptor configuration information from class and property parameters.

BUT:
https://docs.intersystems.com/iris20212/csp/documatic/%25CSP.Documatic.cls?&LIBRARY=%25SYS&CLASSNAME=%25JSON.Generator

This class is used internally by InterSystems IRIS. You should not make direct use of it within your applications. There is no guarantee made about either the behavior or future operation of this class.

Robert Cemper · Feb 26, 2022 go to post

It looks like your JSON Mapping is already content of what you labeled XDATA.
The essence of XDATA is to contain an XML structure to describe your data.
that is to be transformed into a JSON mapping. 
In your case, you have the mapping already in hands.
So what other mapping would you expect ? 

Robert Cemper · Feb 25, 2022 go to post

No, I have no solution.
As all development on Caché (except serious bugfix) is frozen I wouldn't expect this to come.
You may migrate your Caché to IRIS. Or use some other way (REST ?) for access. 

Robert Cemper · Feb 25, 2022 go to post

my personal experience dates back to ~2007 or so.
converting tables using SQLGatewy at the customer side was rather simple.
rewriting ALL stored procedures (in COS) was an enormous effort.
Finally, the soultion provider located in NYC refused cooperation.
This was an O* Platinum Partner.
ISC sales in NYC couldn't convince them crying     

Robert Cemper · Feb 25, 2022 go to post

Hi Dmitry,
Did you ever get some useful echo?
Except: "use the newer version". 
No surprise. But ISC mostly doesn't follow their own rules and suggestions
You may create your own %ZXML.CharacterStream extending  %Stream.GlobalCharacter.
I would not expect as much resistance from ISC as against my backport of %JSON* to Caché