Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JDBC Oracle wallet based connection: Wallet folder in memory

I want to connect to an Oracle database using a wallet stored in memory instead of having the wallet stored on disk.

I tried using Apache Common VFS to read/write files in memory. The wallet is written to memory (to be sure I even wrote the wallet folder from the ram to my disk).

properties.put("oracle.net.tns_admin", "ram://my_wallet");
properties.put("oracle.net.wallet_location",
          String.format("(SOURCE=(METHOD=file)(METHOD_DATA=(DIRECTORY=%s)))", "ram://my_wallet"));

When I try to make a connection using those properties I get the error:

java.sql.SQLRecoverableException: IO Error: could not resolve the connect identifier DB_1222

PS: My code works fine if I put the wallet on disk.

like image 467
Nabila Avatar asked Nov 26 '19 12:11

Nabila


1 Answers

One workaround might be to leverage in-memory file-system support of the OS, so it looks like a normal file to JDBC but the OS is actually storing it in memory. On Unix-like systems, tmpfs would be such a file-system: https://en.m.wikipedia.org/wiki/Tmpfs

like image 169
Korbi Avatar answered Oct 05 '22 04:10

Korbi