Wow how did you pin point that down?

The second time I called the method/query (like your) I looked at the variables and found that %objlasterror was set, then from terminal:

d $system.OBJ.DisplayError()

To get properly formatted error message.

BTW, what is a "Domain Service Account"? From a JDBC authentication I guess it's just a normal domain account with user/password.

Are having the authentication issue with Microsoft JDBC driver only with Domain Service Account or with standard domain user accounts as well?

Enrico

It's an issue of the jTDS, using the connection the second time and IRIS try to reuse the connection there is an error:

ERROR #5023: Remote Gateway Error: java.lang.AbstractMethodError
        at net.sourceforge.jtds.jdbc.JtdsConnection.isValid(JtdsConnection.java:2833)
        at com.intersystems.jdbcgateway.JDBCGateway.isValid(JDBCGateway.java:1982)
        at com.intersystems.jdbcgateway.JDBCGatewayHelper.processMessage(JDBCGatewayHelper.java:642)
        at com.intersystems.gateway.JavaGateway.getJDBCGatewayMessage(JavaGateway.java:2015)
        at com.intersystems.gateway.JavaGateway.processMessage(JavaGateway.java:519)
        at com.intersystems.gateway.JavaGateway.run(JavaGateway.java:458)
        at com.intersystems.gateway.JavaGateway.run(JavaGateway.java:421)

My guess is that for IRIS the connection "is not valid" therefore open a new connection.

It's a known issue already reported.

If you search for "jTDS AbstractMethodError isValid()" you will find many entries..

Enrico

Just tested using "mssql-jdbc-12.2.0.jre8.jar", Java 8 and IRIS:

IRIS for Windows (x86-64) 2022.1 (Build 209U) Tue May 31 2022 12:16:40 EDT

It works fine, the connection is reused correctly. No additional connections are made if I run a query (like your) multiple times from terminal.

I'm using IRIS for Windows, you use same version for RedHat, maybe a platform specific bug?

What jdbc driver & java are you using?

Enrico

So, if you run the FindNPI() method multiple times you end up with miltiple connections to SQL Server?

I'm curious, what do you get if from terminal you run:

ZWrite %JDBCGateway
Set x=##class(osuwmc.CPD.vProviderNPIEns).FindNPI(123)
ZWrite %JDBCGateway
Set x=##class(osuwmc.CPD.vProviderNPIEns).FindNPI(123)
ZWrite %JDBCGateway
Set x=##class(osuwmc.CPD.vProviderNPIEns).FindNPI(123)
ZWrite %JDBCGateway

How many connection to SQL Server are there before and after these commands?

Enrico

why would a query against a Linked Table spawn a new connection every time, wouldn't it reuse a connection?

AFAIK it should work exactly that way and reuse the existing connection.

Evidently in your case it is not reusing the existing connection and create a new connection leaving the old connection "floating".

The "kill %JDBCGateway()" suggested by WRX simply force the close connection so you don't have "floting" connections left over.

There is probably some peculiar behavior in your code......if it's not a bug in your IRIS version.

In fact connections are stored in %JDBCGateway() array, it would be interesting, after disabling the kill, to see the full content of that array before & after using the linked tables a few times.

Enrico

I know this is old, but recently I found a new way to export/import a package to a global, this may simplify the solution.

1) create a studio project with all the classes that need to me exported. This can be done programmatically, create an instance of %Studio.Project, use AddItem()...etc.

2) Export the project to a global like ^IRIS.Temp("myProjExport"). Open %Studio.Project, export ot global using DeployToGbl() method

3) in target namespace import calling ##class(%Studio.Project).InstallFromGbl()

Using ^IRIS.Temp has the advantage of easy/shared access from all namespaces.

Enrico

In fact, even subclassing %CSP.WebSocket or adding your instance methods class as superclass would not work because all the code you write inside a CSP page run in class methods, so you cannot call an instance method.

And this brings back my initial question:

What would be the instance (i.e. $this) of the method?

None I think, within a CSP page code there is no current instance, the "page" is not instantiated, even when using %CSP.WebSocket as superclass.

But...how are you using %CSP.WebSocket??

Something like:
<CSP:CLASS SUPER="%CSP.WebSocket">

Or what/how?

Enrico

If you are looking for actual call that have been made (and not purged), you can SQL query the table Ens.MessagHeader and look in the columns SourceConfigName and TargetConfigName.

The lines down in the production configuration are...well....derived looking/parsing the code and are not fully reliable/accurate depending on how you pass the target parameter to the SendRequestSync/SendRequestAsync methods (if you writhe the code of your Business Hosts).

Enrico

To create a custom CSP login page:

  1. Ensure that the Web Gateway user (CSPSystem) has permissions to read the database for where the custom login page is located. Assign the desired database resource to an appropriate role, and then assign that role to the CSPSystem user.

See:
https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls...

And...this is the demonstration that the feedback button in the documentation pages really does work!
I admit I ran into this problem sometime ago, after realizing the problem I felt the documentation had to mention that "detail"....so I pressed the feedback button and filed the request/advice.

Now that "detail" is the first step in the recipe of creating a custom login page.

Well done InterSystems Documentation team!

Now we only need to encourage people to actually read the documentation wink

Or search the community:
https://community.intersystems.com/post/custom-login-page-iris

Enrico smiley

Yes, there is, at least "everything" IRIS is aware of, so some item maybe missing but can be added.

In SMP, Iteroperability -> List -> Productions, select the production and click "Export" button.

Or, open production configuration, production settings, actions, Export button.

All production items are selected and you can manually add additional classes/components like search tables, custom schema, deployable system default settings, data transformations, etc.

Then, when you deploy your production you can also create a rollback file, in case you want to rollback, see:

https://docs.intersystems.com/irisforhealth20222/csp/docbook/DocBook.UI....

Enrico