zoukankan      html  css  js  c++  java
  • 不使用TNS直连数据库的三种方式

    1、在当前目录下新建tnsnames.ora文件

    如windows环境下,在C:UsersAdministrator目录下新建tnsnames.ora文件,内容如下:
    test =(description=(address=(protocol=tcp)(host=192.168.0.1)(port=1521))(connect_data=(server=dedicated)(service_name=orcl)))
    C:UsersAdministrator>sqlplus sys/rusky@test as sysdba;

    SQL*Plus: Release 11.2.0.1.0 Production on 星期五 2月 13 00:03:51 2015

    Copyright (c) 1982, 2010, Oracle. All rights reserved.

    连接到:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options


    2、sqlplus连接时同时添加DESCTIPTION内容
    C:UsersAdministrator>sqlplus SYS/rusky@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=rusky-PC)(port=1521))(CONNECT_DATA=(SID=orcl))) as sysdba;

    SQL*Plus: Release 11.2.0.1.0 Production on 星期四 2月 12 23:56:33 2015

    Copyright (c) 1982, 2010, Oracle. All rights reserved.

    连接到:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options

    3、使用IP、端口号、实例名直接连接
    C:UsersAdministrator>sqlplus sys/rusky@127.0.0.1:1521/orcl as sysdba;

    SQL*Plus: Release 11.2.0.1.0 Production on 星期四 2月 12 23:58:24 2015

    Copyright (c) 1982, 2010, Oracle. All rights reserved.


    连接到:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options

    《FROM:http://blog.csdn.net/hhuck/article/details/5337764

    =====================================================

    JDBC连接ORACLE的三种方式:

    格式一:jdbc:oracle:thin:@//<host>:<port>/<service_name>
    格式二:jdbc:oracle:thin:@<host>:<port>:<SID> 
    格式三:jdbc:oracle:thin:@<TNSName> 

  • 相关阅读:
    康复计划
    Leetcode 08.02 迷路的机器人 缓存加回溯
    Leetcode 38 外观数列
    Leetcode 801 使序列递增的最小交换次数
    Leetcode 1143 最长公共子序列
    Leetcode 11 盛水最多的容器 贪心算法
    Leetcode 1186 删除一次得到子数组最大和
    Leetcode 300 最长上升子序列
    Leetcode95 不同的二叉搜索树II 精致的分治
    Leetcode 1367 二叉树中的列表 DFS
  • 原文地址:https://www.cnblogs.com/rusking/p/4289449.html
Copyright © 2011-2022 走看看