> For the complete documentation index, see [llms.txt](https://docs.sysout.co.kr/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sysout.co.kr/base-language/java/jdbc/get-connection/jdbc-driver-types.md).

# JDBC Driver 유형

## JDBC Driver 유형

{% hint style="info" %}
참조 사이트

* <https://m.blog.naver.com/PostView.naver?isHttpsRedirect=true&blogId=pjm5111&logNo=220719619162>
* <https://www.progress.com/faqs/datadirect-jdbc-faqs/what-are-the-types-of-jdbc-drivers>
* <https://www.tutorialspoint.com/jdbc/jdbc-driver-types.htm>
  {% endhint %}

JDBC Driver는 개발 당시 다음과 같은 유형으로 구분하였다.

* Type 1 : JDBC-ODBC Bridge Driver
* Type 2 : JDBC Native API
* Type 3 : JDBC-Net Pure Java
* Type 4 : 100% Pure Java

데이터베이스에서 제공하는 표준 개방형 응용 프로그램 인터페이스인 ODBC(Open DataBase Connectivity)를 사용하는 방식이 `Type 1`이고, 의존성이 낮아질 수록 `Type 4`에 가까워진다. `Type 1`의 경우 ODBC를 이용하므로 ODBC 관련 소프트웨어가 클라이언트에 설치되어야 사용 가능 하며, `Type 4`의 경우 매우 유연하므로 클라이언트나 서버에 특별한 소프트웨어를 설치할 필요가 없고 동적으로 다운로드하여 사용할 수 있다. Type이 올라갈 수록 성능이 향상된다고 보면 된다.

오라클의 경우 OCI Driver(Type 2)와 THIN Driver(Type 4)를 제공한다. OCI Driver(Oracle Call Interface Driver)는 JDBC API 호출이 C/C++ Native API 호출로 변경되어 처리된다. 클라이언트에 ODBC Driver가 설치되어 있어야 한다는 특징이 있다. OCI Driver가 데이터베이스에서 제공하는 라이브러리를 그대로 이용할 수 있다는 장점이 있지만 THIN Driver는 중간 과정 없이 직접 DBMS의 프로토콜로 변환하여 처리하기 때문에 단일 데이터베이스에 대한 처리 속도가 가장 빠르다. 따라서 일반적인 상황에서는 THIN Driver를 사용한다.

### JDBC 드라이버 구조

{% hint style="info" %}
이미지 출처 : <https://www.tutorialspoint.com/jdbc/jdbc-driver-types.htm>
{% endhint %}

![Type 1 구조](https://4208234536-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M_TNZwLuHV9ipYLbvRq%2F-MlIkHV8Kw2Xiiq3o1mX%2F-MlIoI723VC-UUnb11no%2Fimage.png?alt=media\&token=17bb422c-0ee3-4435-aee5-19fa0a4dd2b3)

![Type 2 구조](https://4208234536-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M_TNZwLuHV9ipYLbvRq%2F-MlIkHV8Kw2Xiiq3o1mX%2F-MlIoYTHpQ0zKrAm9iXt%2Fimage.png?alt=media\&token=558847cd-f972-454f-8835-4be679d229c6)

![Type 3 구조](https://4208234536-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M_TNZwLuHV9ipYLbvRq%2F-MlIkHV8Kw2Xiiq3o1mX%2F-MlIoa01IhkZ0J9VnEeE%2Fimage.png?alt=media\&token=2e5284f9-41ca-4313-a4d3-0031404de4f6)

![Type 4 구조](https://4208234536-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M_TNZwLuHV9ipYLbvRq%2F-MlIkHV8Kw2Xiiq3o1mX%2F-MlIoay05o2CwE_IDiZD%2Fimage.png?alt=media\&token=e244cef2-d23c-43d7-8154-a630bbd6bd60)
