The Vertica Forum recently got a makeover! Let us know what you think by filling out this short, anonymous survey.
Please take this survey to help us learn more about how you use third party tools. Your input is greatly appreciated!

PHP ODBC get empty data with cyrillic encoded

Hi,

 

I'm working on PHP project to get data from VerticaDB, I'm using a unixODBC driver ( I tried also iODBC), I have a problem with cyrillic encoded records, I'm always getting empty fields.

 

What I found as workaround is to encode the field in SQL query using URI_PERCENT_ENCODE function and in PHP I decode them, it works well for a while until the Vertica server crashes.

 

For testing I create a table with 3 same records:  name : 'ООО Корона Студио'

 

So when I do 

 

SELECT name, URI_PERCENT_ENCODE(name) 
FROM mytable

in php I got this array:

 

array (size=3)
0 =>
array (size=2)
'name' => string '  ' (length=17)
'URI_PERCENT_ENCODE' => string '%D0%9E%D0%9E%D0%9E%20%D0%9A%D0%BE%D1%80%D0%BE%D0%BD%D0%B0%20%D0%A1%D1%82%D1%83%D0%B4%D0%B8%D0%BE' (length=96)
1 =>
array (size=2)
'name' => string '  ' (length=17)
'URI_PERCENT_ENCODE' => string '' (length=0)
2 =>
array (size=2)
'name' => string '  ' (length=17)
'URI_PERCENT_ENCODE' => string '' (length=0)
3 =>

it looks like a bug in URI_PERCENT_ENCODE function, but I would like to avoid using it and get the data encoded correctly.

 

I tried to change DriverManagerEncoding in /etc/vertica.ini from UTF-16 to UTF-8 or UTF-32 but nothing change.

 

this is my configs:

- Vertica Client version 7.2.3-0

 

- /etc/vertica.ini :

 

[Driver]
DriverManagerEncoding=UTF-32
ODBCInstLib = /usr/lib/x86_64-linux-gnu/libodbcinst.so.1
ErrorMessagesPath=/opt/vertica
LogLevel=4
LogPath=/tmp

- /etc/odbc.ini

 

 

Description = Vertica Dev
Driver = /opt/vertica/lib64/libverticaodbc.so
Port = 5433
Driver = Vertica

- /etc/odbcinst.ini

 

 

[Vertica]
Description = Vertica driver
Driver = /opt/vertica/lib64/libverticaodbc.so

 

 

Thanks in advance !

 

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file