You cannot see this page without javascript.

ODBC 설정

Linux 조회 수 1727 추천 수 0 2015.03.18 00:06:26

Setup guide is using the same hardware and CentOS install we used in our prior how to on Zenoss. I use the Zenoss database on the localhost but this can easly be changed for setting up a ODBC connection on a remote host machines useing any database.

This entire install process is done as root, so login to your server and lets get started.
Install myODBC and unixODBC as a dependency.
yum install mysql-connector-odbc

Dependencies Resolved
=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
mysql-connector-odbc i386 3.51.12-2.2 base 142 k
Installing for dependencies:
unixODBC i386 2.2.11-7.1 base 832 k

Transaction Summary
=============================================================================
Install 2 Package(s)
Update 0 Package(s)
Remove 0 Package(s)

Total download size: 973 k
Is this ok [y/N]:
y

Print your config infomation.
odbcinst -j
unixODBC 2.2.11
DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
USER DATA SOURCES..: /root/.odbc.ini


Edit /etc/odbc.inst and /etc/odbcinst.ini
Below are my examples.
vi /etc/odbcinst.ini
[MySQL]
Description = ODBC for MySQL
Driver = /usr/lib/libmyodbc.so
Setup = /usr/lib/libodbcmyS.so
UsageCount = 2

[MySQL ODBC 3.51 Driver]
Description = ODBC 3.51 for MySQL
DRIVER = /usr/lib/libmyodbc3.so
SETUP = /usr/lib/libmyodbc3S.so
UsageCount = 2


vi /etc/odbc.inst
[zenoss]
Driver = /usr/lib/libmyodbc3.so
SERVER = localhost
PORT = 3306
DATABASE = events
OPTION = 3
USER = root
PASSWORD = BlAh

Note: The PASSWORD: is the one we setup during our Zenoss installation and is REQUIRED because Splunk uses it to authenticate to the database.

Once you create your files and save them here is how you do the install.
Install driver
odbcinst -i -d -f /etc/odbcinst.ini

Install system DSN
odbcinst -i -s -l -f /etc/odbc.ini

Test your DSN install by lisinting your installed data sources.
odbcinst -s -q
[zenoss]

Test that you can connect to the database via the ODBC.
isql -v zenoss root BlAh
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL> quit

You are done. Here are some quick and dirty ways to fix some problem I had during the install.
I did not have libtool installed properly.
Install libtool
yum install libtool
edit lb.so.conf

Before the include I added
/opt/splunk/lib <---- I later commented this out.
/user/lib

Load the new ld.so.conf
ldconfig (you will not recive any confermation)

I also had a problem acidently loading user DSN so you can remove the user odbc.ini file or copy the one from /etc to the profile.
rm /home/name/.odbc.ini

How to remove a driver.
odbcinst -u -d -n zenoss
zenoss has been deleted (if it existed at all) because its usage count became zero.

How to remove a datasource.
odbcinst -u -s -l -n zenoss
odbcinst: DSN removed (if it existed at all). ODBC_BOTH_DSN was used as the search path.

Remeber if you change a odbc peramerter you need to install it again.
odbcinst -i -s -l -f /etc/odbc.ini

My next article will be how to setup Splunk to use the Zenoss myODBC connection as a datasource.

List of Articles
번호 제목 글쓴이 날짜sort 조회 수
69 Programing Magic Square (마방진) - 마방진코드와 나의 생각 03 LynX 2016-08-09 1734
68 Linux firewalld DDOS 차단 LynX 2016-08-22 958
67 Linux Apache httpd mod_evasive compile LynX 2016-08-22 260
66 Linux 하위 디렉토리 문자열 일괄검색,치환 LynX 2016-08-24 251
65 Server 웹 동접자 수 확인 코드 LynX 2016-09-08 843
64 Xpress Engine 현재접속과 로그인 수 표시 addon file LynX 2016-09-10 1690
63 Linux DDOS 방어 LynX 2016-09-19 462
62 Xpress Engine xe 현재접속과 로그인 수 표시 addon 수정본 file [1] LynX 2016-09-20 2436
61 Xpress Engine xe 포인트 레벨과 등급 동기화 에드온 2.0 file LynX 2016-09-21 1419
60 Xpress Engine xe 현재접속과 로그인 수 표시 addon 1.3.0 file LynX 2016-09-22 1746
59 APM php7에 memcache.so 확장 모듈 적용 file LynX 2016-09-23 420
58 APM php에 memcached.so 확장 모듈 적용 file LynX 2016-09-23 224
57 Xpress Engine XE에 memcache 사용 설정 LynX 2016-09-23 244
56 Xpress Engine mobileex 사용하여 모바일에서 첨부파일 올릴때 무한 로딩 현상 LynX 2016-09-27 244
55 APM PHP Suhosin 설치 file LynX 2016-09-28 231
54 Linux MAME file LynX 2016-09-28 322
53 LinuxMint joystick install file LynX 2016-09-30 487
52 Linux linux 시간설정 file LynX 2016-10-07 401
51 APM php opcache 설치 file LynX 2016-10-14 1527
50 Network pka파일 만드는 방법 file LynX 2016-10-24 1611

XE Login