You cannot see this page without javascript.

ODBC 설정

Linux 조회 수 1726 추천 수 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
329 Network vpn LynX 2016-06-29 263
328 웹 페이지의 원하는 테이블만 프린트 LynX 2013-03-15 268
327 Xyview DVR서버 연결 [8] LynX 2012-04-19 269
326 웹 프린트 작업시 픽셀과 밀리미터간의 상관관계 (1mm=3.8px ) [8] LynX 2013-03-15 271
325 Xpress Engine XML 쿼리 대신 직접 mysql 사용하기 LynX 2014-07-19 273
324 CentOS CentOS7 WHEEL 계정 추가 file LynX 2017-02-03 275
323 Windows 윈도우 8 pro key LynX 2014-05-26 277
322 32bit Driver을 64bi로 설치하기 [8] LynX 2011-06-21 282
321 윈도우서버2008 - 06 (보안 정책 및 감사) file [10] LynX 2012-11-28 285
320 Linux Linux Apache 2.4 설치 LynX 2014-06-27 286
319 Linux cinnamon [10] LynX 2014-12-11 287
318 Programing cab파일에 인증서 포함하기 LynX 2014-06-13 293
317 Linux [Linux] 특정 계정만 su -(root)를 통한 root접근 허용 LynX 2014-07-04 294
316 Server Windows7에 Apache 설치 file LynX 2013-09-05 297
315 LinuxMint LinuxMint PHP source 설치 [1] LynX 2014-12-30 297
314 Linux 10 - NFS,apache file [10] LynX 2012-11-29 298
313 Programing print script LynX 2013-12-11 300
312 CentOS7 ▒ Doly의 CentOS7 강좌15 5. CentOS 기본설정 2 - 날짜 및 시간설정 file [6] LynX 2014-10-23 300
311 Windows7 에서 시스템을 백업/복원하는 가장 쉬운 방법!! file LynX 2010-11-07 305
310 Linux 03 - VMware,네트워크,VMware인터넷설정,리눅스인터넷 file LynX 2012-11-29 305

XE Login