Connector/C++ 라이브러리를 사용해 MySQL을 연결해보자.

 

https://dev.mysql.com/downloads/connector/cpp/

 

MySQL :: Download Connector/C++

MySQL Connector/C++ provides developers a JDBC-like API driver for MySQL. MySQL Connector/C++ 8.0 and higher is compatible with all MySQL versions starting with MySQL 5.7. Additionally, MySQL Connector/C++ 8.0 and higher supports the new X DevAPI for devel

dev.mysql.com

 

위 링크로 가면 3개의 파일을 다운로드 받을 수 있다. ( 2025 - 06 - 25 기준 )

1. Windows (x86, 64-bit), MSI Installer 

2. Windows (x86, 64-bit), ZIP Archive

3. Windows (x86, 64-bit), ZIP Archive Debug Binaries

 

기본적으로 첫번째 파일로 Connector을 설치한 후 아래 작업을 해야 사용할 수 있다.

나머지 2개는 각각 Release, Debug용 정적라이브러리와 동적라이브러리를 포함하는 파일이다.

 

Visual Studio에서 이 파일을 사용하기 위해 추가 디렉터리를 설정해보자.

include 설정

압축 푼 폴더의 include 경로
프로젝트 속성 C/C++ - 추가 포함 디렉터리에 기록

 

lib 설정

압축 푼 폴더의 lib 경로
프로젝트 속성 - 링커 - 추가 라이브러리 디렉터리에 기록

동적 라이브러리 추가(.dll)

압축 푼 폴더에서 dll 파일 2개 복사
프로젝트 실행 경로에 붙여넣기

 

 

위처럼 구성하면 Connector를 c++에서 사용할 수 있다.

+ Recent posts