Oracle 12c jdbc connect string for PDB

Ref:  h t t p s:// forums.oracle.com/thread/2566804
1 . link string in code

#<!--指定连接数据库用的驱动ojdbc6.jar-->
database.driver=oracle.jdbc.OracleDriver
#// oracle.jdbc.driver.OracleDriver is deprecated and replaced with oracle.jdbc.OracleDriver.
#h t tp://download.oracle.com/otn_hosted_doc/jdeveloper/905/jdbc-javadoc/oracle/jdbc/OracleDriver.html
#<!--指定连接数据库的路径-->
# for oracle 11g
database.url=jdbc:oracle:thin:@localhost:1521:orcl
# for oracle 12c1
database.url=jdbc:oracle:thin:@//127.0.0.1:1522/pdborcl
or
database.url=jdbc:oracle:thin:@127.0.0.1:1522/pdborcl

#<!--指定连接数据库的用户名-->
database.username=test
#<!--指定连接数据库的密码-->
database.password=test
<!--指定数据库使用的SQL-->
hibernate.dialect=org.hibernate.dialect.Oracle9Dialect
#org.hibernate.dialect.OracleDialect
#Oracle10gDialect
#<!--当show_sql属性为true时表示在程序运行时在控制台输出SQL语句,默认为false-->
hibernate.show_sql=false

oracle.maxConnection=100
oracle.expireTime=2400000
oracle.updateTime=600000

2. link DB by using sqlplus
need to add a tns name with SERVICE_NAME in tnsnames.ora

--tnsnames.ora
test1_tnsname =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
    )
    (CONNECT_DATA =
     
      (SERVICE_NAME = orcl.domain.test.com)
    )
  )


-> Sqlplus test_user/test_pwd@test1_tnsname
 



Ref:
-- 1.   h t t p s:// forums.oracle.com/thread/2566804

Connection conn = DriverManager.getConnection
     ("jdbc:oracle:thin:@//localhost:1521/v112", "scott", "tiger");
                        // @//machineName:port/SID,   userid,  password

See pages 2-8 and 2-9 of the JDBC Dev Guide for examples
http ://docs.oracle.com/cd/E16655_01/java.121/e17657.pdf

-- 2. h t t p://joinxin.blogspot.ca/2013/08/connecting-to-12c-database-instance.html
    h t t p s : / / b l o g s .oracle.com/oracle_maps_blog/entry/connecting_to_a_12c_database

评论

此博客中的热门博文

XML, XSL, HTML

Input in element.eleme.io

Data URI是由RFC 2397 ACE