How to connect database using JDBC connect string:
As these days, databases are on cloud and at times the only way seems to connect database using JDBC url format.
it is very simple:
scan name:
sqlplus 'user1/user1@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=myhost.mydomain.myurl)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=PDB19C1)))'
these days scan is default option..
if there are people who want list each node name in connection string or some kind of load balancing IS ON is enabled and still want to connect the way we connect as shown above. the answer is simple and it is below
sqlplus 'user1/user1@(DESCRIPTION = (LOAD_BALANCE = on) (ADDRESS = (PROTOCOL = TCP)(HOST = hostname1)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = hostname2)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = hostname3)(PORT = 1522)) (ADDRESS = (PROTOCOL = TCP)(HOST = hostname4)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = mydatabase)))'
No comments:
Post a Comment