Configure the php environment for accessing the columnar database vertica

Source: Internet
Author: User
Tags sybase columnar database
Article Title: configure the php environment for accessing the columnar database vertica. Linux is a technology channel of the IT lab in China. Including desktop applications, Linux system management, kernel research, embedded systems, open source, and other basic classification vertica is a column-based database similar to Sybase IQ and infobright, and Sybase IQ is not used, this is a simple comparison test with the Community version of infobright 3.4. In the same 0.1 billion-record table, the following query:
Select count (*) from c_log group by level;
Vertica took 5 seconds and infobright took 2 minutes 20 seconds.
The c_log structure of the test table is:
Create table c_log (
Uid varchar (20 ),
Cash integer,
Gold integer,
Level integer,
Rtime datetime,
Tid varchar (20 ),
Act varchar (50 ),
Item varchar (500 ),
Value integer,
Value2 integer,
Time datetime
);
At the same time, the Community edition of infobright does not support the insert statement. It can only use the LOAD statement to insert data. That is to say, the Community Edition does not support Simultaneous Insertion and query, but the business edition of infobright supports. Vertica does not have this problem. Of course, vertica is also commercial and requires money to buy it. On their official website, you can apply for a 30-day license trial.
Php accesses vertica. Unlike accessing infobright, infobright is compatible with the mysql protocol and can be used directly with imysql or pdo_mysql. Vertica is not compatible with the mysql protocol, so it cannot be accessed using the mysql module of php.
The database drivers on the vertica website only support odbc and jdbc, and jdbc is used in java. For php, odbc can only be used for access.
To Use odbc on centos linux 5.x, you must first install unixODBC:
Yum install unixODBC
Then go to the vertica official website to download the odbc driver. Be sure to download it based on your own platform. Here we use 64-bit:
Tar-xvzf vertica_4.0.24_odbc_3.5_unixodbc_x86_64_linux.tar.gz
Cp include/verticaodbc. h/usr/include
Cp lib64/*/usr/lib64
Configure odbc:
Vi/etc/odbc. ini
[ODBC Data Sources]
VerticaDSN = "vertica"
[VerticaDSN]
Description = VerticaDSN ODBC driver
Driver =/usr/lib64/libverticaodbc_unixodbc.so
Database = dbname
Servername = 192.168.1.10
UserName =
Password =
Port = 5433
ConnSettings =
Locale = en_GB
Also change odbcinst. ini:
Vi/etc/odbcinst. ini
[VerticaDSN]
Description = ODBC for VerticaDSN
Driver =/usr/lib64/libverticaodbc_unixodbc.so
[ODBC]
Threading = 1
You can use
Isql-v VerticaDSN username password
If you do not test whether the database can be accessed, the odbc configuration in linux is successful.

[1] [2] Next page

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.