[Dan JIU Jian] Oracle knowledge point sorting (2) database connection and oracle knowledge point

Source: Internet
Author: User

[Dan JIU Jian] Oracle knowledge point sorting (2) database connection and oracle knowledge point
Link navigation for this series:

[Lone sword] Oracle knowledge point sorting (1) Table space and users

[Gu JIU Jian] Oracle knowledge point sorting (2) database connection

[Gu JIU Jian] Oracle knowledge point sorting (3) Import and Export

[Dan JIU Jian] Oracle knowledge point sorting (4) SQL statement DML and DDL

[Dan JIU Jian] Oracle knowledge point sorting (5) Table and View of common database objects

[Lone sword] Oracle knowledge point sorting (6) Procedure, function, and Sequence of common database objects

[Dan JIU Jian] Oracle knowledge point sorting (7) database Common Object Cursor

[Lone sword] Oracle knowledge point sorting (8) Common exceptions

[Lone sword] Oracle knowledge point sorting (9) package of common database objects

[Gu JIU Jian] Oracle knowledge point sorting (10) % type and % rowtype and common functions

2. Database Connection

Use sqlpluse to connect to the database. The tnsping TEST command can check whether the database TEST can be connected.

2.1 local database
1 sqlplus userName/password @ orcl -- orcl is the Oracle database SID2 sqlplus userName/password @ orcl as sysdba -- connect as an administrator
2.2. The database is on the server
1 sqlplus userName/password @ pc01 -- pc01 is the connection instance created through the Net Manage of Oracle 2 sqlplus userName/password@192.168.1.10/orcl -- 192.168.1.10/orcl is the Server IP/Server database SID
-- In this way, you must add the EZCONNECT parameter to the sqlnet. ora file.

Add parameters to the sqlnet. ora file:

Modify NAMES. DIRECTORY_PATH = (TNSNAMES) to NAMES. DIRECTORY_PATH = (TNSNAMES, EZCONNECT ).

If a dedicated PORT number is set for the server connection, use the IP: PORT format in the IP address section.

The second method is strongly recommended in config during development.

2.3. Link string (. Net)
1 Data Source = ORCL; User Id = myUsername; Password = myPassword; -- connect to the Local Machine 2 Data Source = TORCL; User Id = myUsername; Password = myPassword; -- connect to the remote server, configure connection instance 3 Data Source = 192.168.1.10/ORCL in Net Manage; User Id = myUsername; Password = myPassword; -- connect to the remote server, 4 Data Source = (DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = {0}) (PORT = 1521 )))
(CONNECT_DATA = (SID = {1}) (SERVER = DEDICATED); User Id = {2}; Password = {3 };
-- {0} Server IP address, {1} Server database SID, {2} user name, {3} password. This method is completely written by using tnsnames. the content in ora is used to set the Data Source. This method is relatively safe. Sometimes the first three cannot be connected due to various reasons, so this method is used for a reason that has not been further investigated.

 

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.