Oracle 12c JDBC Way to connect to the PDB database

Source: Internet
Author: User

1. Configuring Monitoring

This assumes that the CDB database named Orcl,pdb is under the CDB name PDBORCL
Listener.ora Add (#后面为注释, do not add in)

Sid_list_listener =    (sid_list = (        Sid_desc =             (global_dbname = ORCL)            (sid_name = ORCL)  #这里是SID名         )        (Sid_desc =             (Global_dbname = PDBORCL) #这里是PDB数据库名            (sid_name = ORCL)  #这里是SID名         )     )

Tnsname.ora add

Pdborcl=    (DESCRIPTION = (        address_list = (            ADDRESS = (PROTOCOL = TCP) (HOST = localhost) (PORT =1521))        )        (Connect_data =            (service_name = PDBORCL)  #这里是PDB数据库名        )    )

2. Restart monitoring (requires Administrator privileges)

Lsnrctl Reload

Restart monitoring can also be used with the following code:
Stop listening

Lsnrctl stop

Start monitoring

Lsnrctl start

3. Check the JDBC code
Note: When you connect the PDB, the 1521 port number is not followed by a colon:, but a slash/
For example

String url = "JDBC:ORACLE:THIN:@//LOCALHOST:1521/PDBORCL";  

Oracle 12c JDBC Way to connect to the PDB database

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.