Nab*_*ila 5 oracle ram jdbc apache-commons-vfs oracle-wallet
我想使用存储在内存中的钱包而不是将钱包存储在磁盘上来连接到Oracle数据库。
我尝试使用Apache Common VFS读取/写入内存中的文件。钱包被写入内存(确保我什至将ramera文件夹从ram写入了磁盘)。
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"));
Run Code Online (Sandbox Code Playgroud)
当我尝试使用这些属性建立连接时,出现错误:
java.sql.SQLRecoverableException: IO Error: could not resolve the connect identifier DB_1222
PS:如果将钱包放在磁盘上,我的代码可以正常工作。
一种解决方法可能是利用操作系统的内存文件系统支持,因此它对于 JDBC 来说看起来像一个普通文件,但操作系统实际上将其存储在内存中。在类 Unix 系统上,tmpfs 就是这样一个文件系统: https: //en.m.wikipedia.org/wiki/Tmpfs