//看看thin和oci的url寫法上的區別: jdbc:oracle:thin:@server ip: service jdbc:oracle:oci:@service
/* 1)從使用上來說,oci必須在客戶機上安裝oracle客戶端或才能連接,而thin就不需要,因此從使用上來講thin還是更加方便,這也是thin比較常見的原因。 2)原理上來看,thin是純java實現tcp/ip的c/s通訊; 而oci方式,客戶端通過native java method調用c library訪問服務端,而這個c library就是oci(oracle called interface),因此這個oci總是需要隨着oracle客戶端安裝(從oracle10.1.0開始,單獨提供OCI Instant Client,不用再完整的安裝client) 3)它們分別是不同的驅動類別,oci是二類驅動, thin是四類驅動,但它們在功能上並無差異。 4)雖然很多人說oci的速度快於thin,但找了半天沒有找到相關的測試報告。 */
//官方描述 Oracle provides four different types of JDBC drivers, for use in different deployment scenarios. The 10.1.0 drivers can access Oracle 8.1.7 and higher. While all Oracle JDBC drivers are similar, some features apply only to JDBC OCI drivers and some apply only to the JDBC Thin driver. JDBC OCI client-side driver: This is a JDBC Type 2 driver that uses Java native methods to call entrypoints in an underlying C library. That C library, called OCI (Oracle Call Interface), interacts with an Oracle database. The JDBC OCI driver requires an Oracle client installation of the same version as the driver. The use of native methods makes the JDBC OCI driver platform specific. Oracle supports Solaris, Windows, and many other platforms. This means that the Oracle JDBC OCI driver is not appropriate for Java applets, because it depends on a C library. Starting from 10.1.0, the JDBC OCI driver is available for install with the OCI Instant Client feature, which does not require a complete Oracle client-installation. Please refer to Oracle Call Interface for more information. JDBC Thin client-side driver: This is a JDBC Type 4 driver that uses Java to connect directly to Oracle. It implements Oracle's SQL*Net Net8 and TTC adapters using its own TCP/IP based Java socket implementation. The JDBC Thin driver does not require Oracle client software to be installed, but does require the server to be configured with a TCP/IP listener. Because it is written entirely in Java, this driver is platform-independent. The JDBC Thin driver can be downloaded into any browser as part of a Java application. (Note that if running in a client browser, that browser must allow the applet to open a Java socket connection back to the server.) JDBC Thin server-side driver: This is another JDBC Type 4 driver that uses Java to connect directly to Oracle. This driver is used internally within the Oracle database. This driver offers the same functionality as the client-side JDBC Thin driver (above), but runs inside an Oracle database and is used to access remote databases. Because it is written entirely in Java, this driver is platform-independent. There is no difference in your code between using the Thin driver from a client application or from inside a server. 連接方式有以下幾種: Oralce provides four types of JDBC driver. Thin Driver, a 100% Java driver for client-side use without an Oracle installation, particularly with applets. The Thin driver type is thin. To connect user scott with password tiger to a database with SID (system identifier) orcl through port 1521 of host myhost, using the Thin driver, you would write : Connection conn = DriverManager.getConnection ("jdbc:oracle:thin:@myhost:1521:orcl", "scott", "tiger"); OCI Driver for client-side use with an Oracle client installation. The OCI driver type is oci. To connect user scott with password tiger to a database with SID (system identifier) orcl through port 1521 of host myhost, using the OCI driver, you would write : Connection conn = DriverManager.getConnection ("jdbc:oracle:oci:@myhost:1521:orcl", "scott", "tiger"); Note that you can also specify the database by a TNSNAMES entry. You can find the available TNSNAMES entries listed in the file tnsnames.ora on the client computer from which you are connecting. For example, if you want to connect to the database on host myhost as user scott with password tiger that has a TNSNAMES entry of MyHostString, enter: Connection conn = DriverManager.getConnection ("jdbc:oracle:oci8:@MyHostString","scott","tiger"); If your JDBC client and Oracle server are running on the same machine, the OCI driver can use IPC (InterProcess Communication) to connect to the database instead of a network connection. An IPC connection is much faster than a network connection. Connection conn = DriverManager.getConnection ("jdbc:oracle:oci8:@","scott","tiger"); Server-Side Thin Driver, which is functionally the same as the client-side Thin driver, but is for code that runs inside an Oracle server and needs to access a remote server, including middle-tier scenarios. The Server-Side Thin driver type is thin and there is no difference in your code between using the Thin driver from a client application or from inside a server. Server-Side Internal Driver for code that runs inside the target server, that is, inside the Oracle server that it must access. The Server-Side Internal driver type is kprb and it actually runs within a default session. You are already "connected". Therefore the connection should never be closed. To access the default connection, write: DriverManager.getConnection("jdbc:oracle:kprb:"); or: DriverManager.getConnection("jdbc:default:connection:"); You can also use the Oracle-specific defaultConnection() method of the OracleDriver class which is generally recommended: OracleDriver ora = new OracleDriver(); Connection conn = ora.defaultConnection(); Note: You are no longer required to register the OracleDriver class for connecting with the Server-Side Internal driver, although there is no harm in doing so. This is true whether you are using getConnection() or defaultConnection() to make the connection. Any user name or password you include in the URL string is ignored in connecting to the server default connection. The DriverManager.getConnection() method returns a new Java Connection object every time you call it. Note that although the method is not creating a new physical connection (only a single implicit connection is used), it is returning a new object. Again, when JDBC code is running inside the target server, the connection is an implicit data channel, not an explicit connection instance as from a client. It should never be closed.
另轉一篇:不安裝Oracle客戶端遠程連接Orcale數據庫
http://blog.csdn.net/shenyc/archive/2009/10/28/4737937.aspx
今天想在Springboot多模塊項目中讓兩個子模塊通過rpc交互,引入了grpc相關依賴,加好了插件,編譯生成了代碼,結果生成的*ServiceGrpc.java就報錯“”找不到符號”了,一看是找不到這個註解: @javax.annot
每篇一句 大魔王張怡寧:女兒,這堆金牌你拿去玩吧,但我的銀牌不能給你玩。你要想玩銀牌就去找你王浩叔叔吧,他那銀牌多 前言 爲了講述好Spring MVC最爲複雜的數據綁定這塊,我前面可謂是做足了功課,對此部分知識此處給小夥伴留一個學
1、下載hadoop-x.y.x.tar.gz 2、解壓:tar -zxvf hadoop-2.y.x.tar.gz 3、配置環境變量:$JAVA_HOME、$HADOOP_HOME、$PATH 4、修改配置:$HADOOP_HOME/et
5 月 22 日,在最新一期的飛天發佈時刻上,阿里雲宣佈多款可觀測產品全面升級,其中一項是應用實時監控服務 ARMS 在業內率先推進了與 OpenTelemetry 開源生態的全面融合,極大豐富了可觀測的數據類型及規模,大幅增強了 ARMS
一、前言 軟件在持續的開發和維護過程中,會不斷添加新功能和修復舊的缺陷,這往往伴隨着代碼的快速增長和複雜性的提升。若代碼庫沒有得到良好的管理和重構,就可能積累大量的技術債務,包括不一致的設計、冗餘代碼、過時的庫和框架以及不再使用的功能。
導語 | 近期 TIOBE 最新指數顯示,PHP 的流行度降至了歷史最低,排在第 17 名,同時,在年度 Stack Overflow 開發者調查報告中,PHP 在開發者中的受歡迎程度已經從之前的約 30% 萎縮至現在的 18%。“P
1-背景 後臺BFF層服務爲了SEO,涉及大量對底層數據的聚合,如果按照過程化編程,串行執行請求數據再聚合會造成很高的延遲,因此我們往往大量使用多線程技術並行化多個查詢,來減少單個請求的響應時間。 多線程一定程度上也能達成通過並行化提升
一、 背景 最近在做大模型相關的項目,其中有個模塊需要提取在線視頻語音爲文本並輸出給用戶。作爲一個純後端Jave工程師,搞這個確實是初次嘗試。 二、 調研 基於上述功能模塊,主要有三大任務:1、 提取網頁中的視頻 2、 視頻轉語音 3、 語
1-前言 本文根據實際遇到的線程池使用導致的性能問題,從代碼層面解析 線程池 核心線程數、最大線程數、工作隊列三個參數配置不佳容易產生的問題,以及對這些問題的建議 對線程池的更多解析,這篇文章講得已經比較詳細了,建議大家仔細研讀:《阿里規
1-概述 1.1 背景 企知道後臺服務存在大量的查詢可以併發,大量用到了java8的CompletableFuture特性,但是在性能測試中,遇到了併發的瓶頸。 經過分析,發現是由於CompletableFuture默認線程池以及公共線
開源之夏是什麼 “開源之夏(OSPP)” 是中國科學院軟件研究所 “開源軟件供應鏈點亮計劃” 指導下的系列暑期活動,旨在鼓勵在校學生積極參與開源軟件的開發維護,培養和發掘更多優秀的開發者,促進優秀開源軟件社區的蓬勃發展,助力開
背景 在高併發的系統中,通常不會打印除參數校驗失敗或捕獲異常之外的日誌,防止對接口的性能產生影響。 那對於請求不符合預期的情況,我們如何快速找到是哪塊邏輯影響的至關重要。 Pfinder提供的鏈路監控,更多的是性能層面的監控,無法滿足
在網絡爬蟲的開發過程中,經常會遇到需要使用代理服務器的情況。代理服務器不僅可以幫助隱藏真實IP地址,還可以繞過網站的訪問限制,提高數據抓取的成功率。然而,在實際應用中,使用代理服務器也會遇到一些問題,如連接超時、IP被封禁等。因此,本文將
一、背景 上週小組有個需求上線牽扯9個應用(小組目前維護了26個服務,由於團隊系統業務屬性特徵基於高可用、高性能原則拆分,有些是合理的,有些不是很合理的),同時上週OpsReview的一個微服務濫用典範案例(Promise服務A調用服務B,
JSON簡介: JSON(Java Script Object Notation)是一種輕量級的數據交換格式,通常用於在不同系統之間傳輸數據。它基於 JavaScript 對象語法,但已成爲一種獨立於語言的格式。JSON 數據以鍵值對的形式