Coder Social home page Coder Social logo

apisarenco / clickhouse-odbc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from clickhouse/clickhouse-odbc

0.0 2.0 0.0 4.14 MB

ODBC driver for ClickHouse

Home Page: https://clickhouse.yandex

License: Apache License 2.0

CMake 2.58% C++ 95.00% C 0.15% Shell 1.30% Perl 0.68% Python 0.13% Batchfile 0.16%

clickhouse-odbc's Introduction

Build Status

If you are macos user see MACOS.md

Cloning a Project with Submodules

Please note - git submodules are used in this project.

When you clone such a project, by default you get the directories that contain submodules, but none of the files within them. So, in order to build the project, you need either:

  • clone repo with all submodules altogether (use --recursive)
git clone --recursive https://github.com/yandex/clickhouse-odbc
  • or add submodules manually after main project cloned - in the root of source tree run:
git submodule update --init --recursive

Installing Prerequisites (Linux)

You'll need to have installed:

  • Fresh C compiler, which understands -std=c++14
  • Static libraries
    • static libgcc
    • static libstdc++
    • static libodbc
  • cmake >= 3

DEB-based Linux

Install unixodbc-dev >= 2.3.0 or libiodbc2-dev

sudo apt install unixodbc-dev

or

sudo apt install libiodbc2-dev

RPM-based Linux

CentOS is shipped with gcc 4.X, which is not suitable for this task. Fedora and CentOS do not have static libodbc provided, so you'll need either to build your own, or download 3-rd party packages. Static libodbc is available for Fedora 25 and Fedora 26. If you are running another OS, you can try to build your own RPMs from this project.

Building (Linux)

  1. At the root of source directory:
mkdir -p build; cd build && cmake .. && make -j $(nproc || sysctl -n hw.ncpu || echo 4)

Please use cmake3 to build the project on CentOS 7. You can install it with yum install cmake3.

  1. libclickhouseodbc.so will be at build/driver/libclickhouseodbc.so
mkdir -p build; cd build && cmake .. && make -j $(nproc || sysctl -n hw.ncpu || echo 4)

Building (Linux Debian based .deb package)

sudo apt install -y devscripts debhelper cmake ninja-build lsb-release unixodbc-dev
debuild -us -uc -i --source-option=--format="3.0 (native)"

or

sudo apt install -y sudo pbuilder fakeroot debhelper debian-archive-keyring debian-keyring
sudo pbuilder create --configfile debian/.pbuilderrc && pdebuild --configfile debian/.pbuilderrc

Building (windows visual studio)

cd vs && build_vs.bat

Building (windows cmake) (Developer only: setup window still not working)

cd vs && build_cmake.bat

Build with tests (needs configured ~/.odbc.ini with DSN=clickhouse_localhost)

( cd ../contrib && git clone https://github.com/nanodbc/nanodbc )
cmake -G Ninja -DTEST_DSN=clickhouse_localhost -DCMAKE_BUILD_TYPE=Debug -DUSE_DEBUG_17=1 .. && ninja
ctest -V```


## ODBC configuration

edit ~/.odbc.ini :

```(ini)
[ClickHouse]
Driver = $(PATH_OF_CLICKHOUSE_ODBC_SO)
# Optional settings:
#Description = ClickHouse driver
# New all-in one way to specify connection with [optional] settings:
#url = https://default:password@localhost:8443/query?database=default&max_result_bytes=4000000&buffer_size=3000000
# Minimal (will connect to port 8443 if https:// or 8123 if http:// ):
url = https://localhost

# Old way:
#server = localhost
#password = 123456
#database = default
#uid = default
#port = 8123

# sslmode variants: allow - ignore self-signed and bad certificates; require - check certificates (and fail connection if something wrong)
#sslmode = require
#privatekeyfile =
#certificatefile =
#calocation =

#trace=1
#tracefile=/tmp/chlickhouse-odbc.log

Sometimes you should change ~/.odbcinst.ini or /etc/odbcinst.ini or /Library/ODBC/odbcinst.ini :

[Clickhouse]
Driver=$(PATH_OF_CLICKHOUSE_ODBC_SO)

Testing

Run isql -v ClickHouse

Also look test/ contents

clickhouse-odbc's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.