Disable Shared Memory in JDBC Driver URL
Hey guys!
I'm working on a Java application that connects to Iris via JDBC.
I need to disable SharedMemory via connection URL.
I would like to know how I can check if the parameter was turned on or off within Iris when connecting to Java.
Thanks for your help!
Comments
One way to do that is to use your server's LAN IP in the JDBC URL instead of using 127.0.0.1 or localhost, if that suits your needs.
You can cast the Connection to IRISConnection.isUsingSharedMemory() to see if the current connection is connected via shared memory.
You can disable it when getting a connection by passing a Property = SharedMemory=false
You can also disable it on a DataSource with setSharedMemory(false)
I'm curious why would you need it, are there any issues when working via shared memory?
As already mentioned, you have some options, use a different host, or use DriverParameters
Optional. Boolean indicating whether or not to always use shared memory for localhost and 127.0.0.1. Default = null. See IRISDataSource methods getSharedMemory() and setSharedMemory(). Also see “Shared Memory Connections”.
For instance, in DBeaver it may look like this, if there is no SharedMemory option visible, you still can add it manually
.png)
I'm not sure what Matheus' specific issue was, but I had to do this when using SAP's Crystal Reports Java API because when shared memory was enabled, it tended to leave connections hanging open when it shouldn't, and eventually the number of connections would exceed the maximum. With shared memory disabled, it worked as expected.
Hello. Actually, I'm trying to disable SharedMemory by passing the parameter in the JDBC (Java) driver URL. My question is whether I can check somewhere in the Intersystem Iris database whether SharedMemory has actually been disabled for this connection.