[unixODBC][Driver Manager]Data source name not found.

Moderator: NorbertKrupa

Post Reply
kranthi
Newbie
Newbie
Posts: 1
Joined: Fri Oct 04, 2013 1:15 pm

[unixODBC][Driver Manager]Data source name not found.

Post by kranthi » Fri Oct 04, 2013 1:25 pm

Hi,
I'm unable to connect vertica through php.I'm getting below error

php > $conn = odbc_connect('odbc:DRIVER={verticaDSN};Server=192.168.85.129;Database=dbadmin',"dbadmin", "password");
PHP Warning: odbc_connect(): SQL error: [unixODBC][Driver Manager]Data source name not found, and no default driver specified, SQL state IM002 in SQLConnect in php shell code on line 1

php > $conn = odbc_connect('odbc:DRIVER={VerticaDSN};Server=192.168.85.129;Database=dbadmin',"dbadmin", "password");
PHP Warning: odbc_connect(): SQL error: [unixODBC][Driver Manager]Data source name not found, and no default driver specified, SQL state IM002 in SQLConnect in php shell code on line 1

my odbc.ini file

cat /usr/local/etc/odbc.ini
[VerticaDSN]
Description = VerticaDSN ODBC driver
Driver = /opt/vertica/lib64/libverticaodbc.so.6.1.2
Database = dbadmin
Servername = 192.168.85.129
UserName = dbadmin
Password = password
Port = 5433
#ConnSettings =
SSLKeyFile = /home/dbadmin/client.key
SSLCertFile = /home/dbadmin/client.crt
Locale = en_US

And

cat /usr/local/etc/odbcinst.ini
[VerticaDSN]
Description = ClickStream example database
Driver = /opt/vertica/lib/libverticaodbc.so.6.1.2
[ODBC]
Threading = 1

cat /etc/vertica.ini
[Driver]
Locale = en_US
DriverManagerEncoding=UTF-16
ODBCInstLib=/usr/lib64/libodbcinst.so
ErrorMessagesPath=/opt/vertica/lib64
LogLevel=4
LogPath=/tmp



Please help me


Thanks

id10t
GURU
GURU
Posts: 732
Joined: Mon Apr 16, 2012 2:44 pm

Re: [unixODBC][Driver Manager]Data source name not found.

Post by id10t » Fri Oct 04, 2013 1:40 pm

Hi!

Questions:
1. Are you connecting via SSL? If no, so comment lines in config.
2. Why you need to define language twice? (odbc.ini, vertica.ini)

To the problem:
default location of odbc.ini and odbcinst.ini - is "/etc" directory (for global config) or "/home/$USER/" for user config.
You don't know how to read? WHY YOU DEFINED it "/usr/local/etc/"?
https://my.vertica.com/docs/6.1.x/HTML/ ... #11705.htm
Creating an ODBC DSN for Linux, Solaris, AIX, and HP-UX

DSNs are defined on Linux, Solaris, and other UNIX-like platforms in a text file. Your client's driver manager reads this file to determine how to connect to your HP Vertica database. The driver manager usually looks for the DSN definitions in two places:

/etc/odbc.ini
~/.odbc.ini (a file named .odbc.ini in the user's home directory)

The structure of these files is the same, only their location differs. If both files are present, the ~/.odbc.ini file usually overrides the system-wide /etc/odbc.ini file.
PS
Validate locations:
1. /etc/odbc.ini
2. /etc/odbcinst.ini
3. echo $VERTICAINI

PPS
Learn to Read English Online at GCFLearnFree.org: http://www.gcflearnfree.org/reading

DGh
Newbie
Newbie
Posts: 14
Joined: Tue Oct 08, 2013 10:10 pm

Re: [unixODBC][Driver Manager]Data source name not found.

Post by DGh » Tue Oct 15, 2013 11:55 pm

Hi ,
Got stuck with another issue.
I am trying to setup ODBC on a CentOS server so that I can connect to postgres and Vertica.

Postgres works fine over odbc (tested via isql- installed the unixODBC)
Vertica throws this error -
[IM004][unixODBC][Driver Manager]Driver's SQLAllocHandle on SQL_HANDLE_HENV failed
[ISQL]ERROR: Could not SQLConnect
This is after I followed the post on updating the odbc.ini with a [Driver] section and exporting the verticaini env variable.
The older error went away:
[
[S1000][unixODBC][DSI] The error message NoSQLGetPrivateProfileString could not be found in the en-US locale. Check that /en-US/ODBCMessages.xml exists.
]

replaced by what I have above.
I am running vertica version 6.

thanks a lot for all the help!
DGh

----update
Sorry about the false alarm. Turned out that my password had special characters - and I didnt need to quote it in the odbc.ini file. Once I did that it worked like charm.
thanks you all!
DGh

Post Reply

Return to “PHP”