偷偷摘套内射激情视频,久久精品99国产国产精,中文字幕无线乱码人妻,中文在线中文a,性爽19p

Oracle 數(shù)據(jù)庫(kù)中三種不同類型的JDBC驅(qū)動(dòng)

數(shù)據(jù)庫(kù) Oracle
我們今天主要介紹的是Oracle 數(shù)據(jù)庫(kù)里三種不同類型的JDBC驅(qū)動(dòng)以及其實(shí)際相關(guān)代碼的描述,以下就是文章的具體內(nèi)容的描述。

以下的文章主要介紹的是Oracle 數(shù)據(jù)庫(kù)里三種不同類型的JDBC驅(qū)動(dòng),我們大家都知道Oracle 中的jdbc驅(qū)動(dòng)主要有以下的三類,即,1、JDBC OCI: oci是Oracle call interface的縮寫(xiě),此驅(qū)動(dòng)類似于傳統(tǒng)的ODBC 驅(qū)動(dòng)。

因?yàn)樗枰狾racle Call Interface and Net8,所以它需要在運(yùn)行使用此驅(qū)動(dòng)的JAVA程序的機(jī)器上安裝客戶端軟件,其實(shí)主要是用到orcale客戶端里以dll方式提供的oci和服務(wù)器配置。

2、JDBC Thin: thin是for thin client的意思,這種驅(qū)動(dòng)一般用在運(yùn)行在WEB瀏覽器中的JAVA程序。它不是通過(guò)OCI or Net8,而是通過(guò)Java sockets進(jìn)行通信,是純java實(shí)現(xiàn)的驅(qū)動(dòng),因此不需要在使用JDBC Thin的客戶端機(jī)器上安裝orcale客戶端軟件,所以有很好的移植性,通常用在web開(kāi)發(fā)中。

3、JDBC KPRB: 這種驅(qū)動(dòng)由直接存儲(chǔ)在數(shù)據(jù)庫(kù)中的JAVA程序使用,如Java Stored Procedures 、triggers、Database JSP's。因?yàn)槭窃诜?wù)器內(nèi)部使用,他使用默認(rèn)或當(dāng)前的會(huì)話連接來(lái)訪數(shù)據(jù)庫(kù),不需要用戶名密碼等,也不需要數(shù)據(jù)庫(kù)url。

在應(yīng)用開(kāi)發(fā)的時(shí)候,通常是用前面兩種方式,下面是數(shù)據(jù)庫(kù)url的寫(xiě)法:

 

  1. jdbc:Oracle :thin:@server ip: service  
  2. jdbc:Oracle :oci:@service  

 

看來(lái)oci的還更加簡(jiǎn)潔,ip可以省掉不寫(xiě)了,這是因?yàn)閛ci驅(qū)動(dòng)通過(guò)客戶端的native java methods來(lái)?xiàng)l用c library方式來(lái)訪問(wèn)數(shù)據(jù)庫(kù)服務(wù)器,使用到了客戶端的net manager里的數(shù)據(jù)庫(kù)服務(wù)配置。

因?yàn)閛ci方式最終與數(shù)據(jù)庫(kù)服務(wù)器通信交互是用的c library庫(kù),理論上性能優(yōu)于thin方式,據(jù)說(shuō)主要是體現(xiàn)在blob字段的存取上。

開(kāi)發(fā)Oracle 數(shù)據(jù)庫(kù)經(jīng)常用到的 pl sql dev使用的估計(jì)是oci方式,需要安裝客戶端,但也可以不安裝,但是要抽出其中的oci相關(guān)的dll即jar包、注冊(cè)環(huán)境變量、配置偵聽(tīng)文件等。Oracle 在10g之后提供了精簡(jiǎn)客戶端,安裝的過(guò)程應(yīng)該包括上面的那些工作。

 

  1. How does one connect with the JDBC OCI Driver?  
  2. One must have Net8 (SQL*Net) installed and working before attempting to use one of the OCI drivers.  
  3. Code: [Copy to clipboard]  
  4. import java.sql.*;  
  5. class dbAccess {  
  6. public static void main (String args []) throws SQLException  
  7. {  
  8. try {  
  9. Class.forName ("Oracle .jdbc.driver.Oracle Driver");  
  10. } catch (ClassNotFoundException e) {  
  11. e.printStackTrace();  
  12. }  
  13. Connection conn = DriverManager.getConnection  
  14. ("jdbc:Oracle :oci8:@ORA1", "scott", "tiger");  
  15. // or oci9 @Service, userid, password  
  16. Statement stmt = conn.createStatement();  
  17. ResultSet rset = stmt.executeQuery (  
  18. "select BANNER from SYS.V_$VERSION"  
  19. );  
  20. while (rset.next())  
  21. System.out.println (rset.getString(1)); // Print col 1  
  22. stmt.close();  
  23. }  
  24. }  
  25. How does one connect with the JDBC KPRB Driver?  
  26. One can obtain a handle to the default or current connection 
    (KPRB driver) by calling the Oracle Driver.defaultConenction() method. 
    Please note that you do not need to specify a database URL, 
    username or password as you are already connected to a database session. 
    Remember not to close the default connection. 
    Closing the default connection might throw an exception in future releases of Oracle .  
  27. import java.sql.*;  
  28. Code: [Copy to clipboard]  
  29. class dbAccess {  
  30. public static void main (String args []) throws SQLException  
  31. {  
  32. Connection conn = (new  
  33. Oracle .jdbc.driver.Oracle Driver()).defaultConnection();  
  34. Statement stmt = conn.createStatement();  
  35. ResultSet rset = stmt.executeQuery (  
  36. "select BANNER from SYS.V_$VERSION"  
  37. );  
  38. while (rset.next())  
  39. System.out.println (rset.getString(1)); // Print col 1  
  40. stmt.close();  
  41. }  
  42. }   

以上的相關(guān)內(nèi)容就是對(duì)Oracle 數(shù)據(jù)庫(kù)中三種類型的JDBC驅(qū)動(dòng)的介紹,望你能有所收獲。

【編輯推薦】

  1. OracleSQL調(diào)優(yōu)的作用是什么?
  2. Oracle權(quán)限分類及其具體內(nèi)容
  3. Oracle 查詢記錄相關(guān)效率的查詢
  4. Oracle存取LONG類型字段的方案描述
  5. Oracle數(shù)據(jù)庫(kù)的類型LONG功能的介紹
責(zé)任編輯:佚名 來(lái)源: 博客園
相關(guān)推薦

2010-04-12 16:35:15

Oracle數(shù)據(jù)庫(kù)

2010-04-02 13:15:01

Oracle跟蹤

2009-07-22 11:33:14

JDBC連接Sybas

2010-07-07 09:14:35

SQL Server數(shù)

2010-11-19 14:51:09

Oracle數(shù)據(jù)庫(kù)關(guān)閉

2011-05-26 13:16:37

Oracle數(shù)據(jù)庫(kù)備份

2010-10-26 13:33:08

Oracle自動(dòng)備份

2019-11-23 17:10:58

MySQL數(shù)據(jù)庫(kù)default

2022-12-20 10:48:24

數(shù)字化轉(zhuǎn)型首席信息官

2009-08-06 15:26:18

C#異常類型

2010-03-30 11:15:26

Oracle數(shù)據(jù)庫(kù)

2011-08-01 18:42:40

分區(qū)維度物化視圖

2011-04-12 11:46:26

Oracle優(yōu)化器

2010-05-10 09:48:46

Oracle優(yōu)化器

2017-06-29 14:12:13

SQL ServerMysqlOracle

2018-01-17 15:02:28

VMware網(wǎng)絡(luò)連接

2010-07-29 09:56:45

Flex數(shù)據(jù)庫(kù)

2011-05-20 17:08:32

2024-02-26 13:47:00

C#Socket數(shù)據(jù)接收

2020-08-27 07:00:00

游戲游戲測(cè)試測(cè)試技術(shù)
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)