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

Linux Install Adobe Flash Player 11.2 on CentOS/RHEL 6.5 file

  • LynX
  • 2014-06-28
  • 조회 수 2286

Xpress Engine xe 현재접속과 로그인 수 표시 addon 수정본 file [1]

  • LynX
  • 2016-09-20
  • 조회 수 2238

Linux lets'encrypt 설치

  • LynX
  • 2015-12-24
  • 조회 수 2226

Programing Magic Square (마방진) - 4배수가 아닌 짝수

  • LynX
  • 2016-07-15
  • 조회 수 2167

CentOS DNS 설치

  • LynX
  • 2015-12-24
  • 조회 수 2157

Linux FreeBSD APM Source Compile

  • LynX
  • 2016-05-20
  • 조회 수 2145

Programing 웹사이트 APK 만들기 file [1] [17]

  • LynX
  • 2015-07-02
  • 조회 수 2102

Windows 7 윈도우7(Windows7) 공유폴더에 암호걸기 file [7]

  • LynX
  • 2013-07-25
  • 조회 수 2087

Server 아파치 - 톰캣 연동하기 (PHP, JSP 같이 사용하기)

  • LynX
  • 2014-05-19
  • 조회 수 1963

Programing Magic Square (마방진) - 4의 배수

  • LynX
  • 2016-07-15
  • 조회 수 1904

APM CentOS7 에서 apache에 mod_http2 적용하기 file

  • LynX
  • 2017-02-07
  • 조회 수 1856

Programing make - 07 접미사 규칙

  • LynX
  • 2017-02-22
  • 조회 수 1853

Linux WOW server [13]

  • LynX
  • 2015-01-11
  • 조회 수 1847

HTML Tag css, cascading style sheets, 스타일 정의 방법 [9]

  • LynX
  • 2015-02-06
  • 조회 수 1832

Network GNS3 메뉴 , VPCS file [34]

  • LynX
  • 2015-04-29
  • 조회 수 1796

APM mariadb download origin address

  • LynX
  • 2019-06-19
  • 조회 수 1785

Programing Magic Square (마방진) - 마방진코드와 나의 생각 01

  • LynX
  • 2016-07-27
  • 조회 수 1741

Linux ODBC 설정 [30]

  • LynX
  • 2015-03-18
  • 조회 수 1726

Server sso file

  • LynX
  • 2013-12-18
  • 조회 수 1716

Programing Magic Square (마방진) - 홀수

  • LynX
  • 2016-07-15
  • 조회 수 1677

XE Login