I'm using oracle database 12c and spring boot 2.3 with data JPA. My goal is to connect with the wallet throw TCPS to the database. There is no example or guides for this on the net as I searched. Can anyone explain and show some examples for this?
I'm using oracle database 12c and spring boot 2.3 with data JPA. My goal is to connect with the wallet throw TCPS to the database. There is no example or guides for this on the net as I searched. Can anyone explain and show some examples for this?
Commonly, in the java world, the most used driver is the THIN which is a pure java driver implementation provided by oracle which uses sockets to the connection. There are other options:
Source: https://stackoverflow.com/a/21711330/3957754
There are not other options to connect to oracle from java.
In short, is just an option provided by oracle to hide the user and password when some client (java, c#, oracle sql developer, agents, etc) wants to establish a connection to the database instance.
Here an example of traditional connection from spring boot in which user and password are required:
spring:
datasource:
url: jdbc:oracle:thin:@host:port:sid
username: user
password: pwd
For more details check these links:
If user & password are not required, what is the magic? Of course there are no magic. As any other service, the alternative is a file. So if you review the following links, you will find a lot of steps to create some special files that the client(java, c#, oracle sql developer, agents, etc) should use instead user and password:

After a lot of lectures, I found these links:
In which as other lectures, one option is to use the classic file called tnsnames.ora specifying the absolute path MY_WALLET_DIRECTORY of the wallet files:
MY_AWESOME_ID= (description= (retry_count=20)(retry_delay=3)(address=(protocol=tcps)(port=1522)
(host=adb.eu-frankfurt-1.oraclecloud.com))(connect_data=(service_name=oracon_frankfurtdb.atp.oraclecloud.com))
(security=(ssl_server_cert_dn="CN=adwc.eucom...")
(MY_WALLET_DIRECTORY=D:\_Downloads_\Oracle_DB_Client_19.3\network\admin\FRANKFURT)(SSL_VERSION=1.2)(SSL_SERVER_DN_MATCH=yes)))
Comparing the previous with some official tnsnames.ora templates, we can see that just MY_WALLET_DIRECTORY under security do the job :
MYSID=
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = mydnshostname)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = MYSID)
)
)
Another links:
According to this, we can use tnsnames.ora directly on THIN connection passing the folder which contains the wallet files to the TNS_ADMIN parameter:
jdbc:oracle:thin:@wallet_dbname?TNS_ADMIN=/foo/bar/
or more elegantly
jdbc:oracle:thin:@wallet_dbname?TNS_ADMIN=$ORACLE_HOME/network/admin
This configuration requires extra libraries 18.3 JDBC drivers.
As you can see, a lot and crazy steps are required to implement this kind of authentication. Also is not devops compatible because manual or human tasks are required. You could use docker to automate that. Anyway is to complex and tedious this implementation.
If the attacker was able to obtain your user & password using the following ways, Why couldn't he access the oracle wallet files?:
I advice to use the classic way: THIN with user & password but with these security dispositions: