How to connect JDBC to tns oracle

You have to set a property named oracle.net.tns_admin to point to the location of the folder containing your tnsnames.ora file. Then you specify the entry from that file after the @ sign in your DB URL. Check example below. You can find more information here: Data sources and URLs – Oracle Documentation import java.sql.*; public … Read more

TNS-12505: TNS:listener does not currently know of SID given in connect descriptor

You need to add the SID entry for XE in order to register the instance with the listener. After installation of Oracle XE, everything looks good, but when you issue C:\>sqlplus / as sysdba SQL>shutdown immediate SQL>startup TNS-12505: TNS:listener does not currently know of SID given in connect descriptor the instance will not register with … Read more