Is there a way to connect to a Vertica database with PHP -- a function similar to mysql_connect()?
I'm ultimately trying to write a script that pulls data from a Vertica database and stores it in a localhost MySQL database.
If necessary, I would be willing to work with Python to make this happen.
The PHP ODBC module (classic or PDO) works fine for Vertica connections. You'll need to download the appropriate ODBC driver for your Vertica version from the My Vertica portal and install it on your PHP server.
Also you can use a Postgres client libraries to connect to Vertica instance.
Related
I am trying to setup remote access to the data of Sage 100 Advanced ERP for use within a website running on a MySQL database. I only need to get inventory levels for products, so it's a read-only application.
As I understand it, Sage 100 comes with an ODBC driver that can allow remote access to Sage's flat-file data storage by creating a database view. What I need to do is copy a few fields from that data on the Sage server over to the web server hosting the website.
To automate this process, I assume I'll need to setup a cron job on the web server that runs a PHP script (preferred language) executing SQL queries that connect to the remote server, extract the needed data, and write it to the appropriate tables in the MySQL database. I'm fine with that last step, but I'm unsure of the steps to connect and retrieve data from the ODBC data source.
How can I connect to and extract Sage 100 data from an ODBC Data Source to write to a MySQL Database on another server?
Or, is there a way to sync/mirror the ODBC Data Source to a MySQL Database on a separate server that I could then use to copy data over to the website's database?
Note: MySQL has documentation on pulling data FROM MySQL using ODBC, but no info on how to import data TO MySQL using ODBC on an external server.
It's actually very easy. Just establish an ODBC connection to the SOTAMAS90 DSN. Your connection string looks like this:
"DSN=SOTAMAS90; UID=MyUserId; PWD=MyPassword; Company=ABC"
Note that by default Sage installs a 32-bit version of the driver, which means you must target your application to 32 bits. Or you can install the 64-bit version of the driver, which can be found in your Sage directory, in the WKSetup folder.
After that just write code to SELECT * from each of the tables you need, and write them into your MySql database.
I don't really know MySql well, but in SQL Server you can set up a Linked Server, point it to SOTAMAS90, and then query the SQL Server database instead of the ODBC driver. But it's slow. Much better performance if you can run a nightly ETL to populate your MySQL database and query that. Be sure to set foreign keys and create indexes for them after to define the tables.
Hope that helps.
Aaron
I have installed Hadoop 2.7 and Hive 1.2.1 on Ubuntu 14.04 that manage sensor data. I have already stored data sensor to Hive.
My Project is to make a web server from it and a web application that can show data record from hive table.
My problem is How to connect database Hive with php? I found Apache Thrift to do that. but I dont understand (Im new at Hadoop things)
Can someone give me tutorial or step by step to solve my problem
One way to try is to use ODBC. If you do not know, how to use ODBC. Read more on that via: Using PHP can I use a JDBC or ODBC connection?
Once, you can setup your ODBC connection, you can use ODBC to connect to the hiveserver. To install, ODBC here two links on how to do that on Cloudera resp. Hortonworks.
http://www.cloudera.com/downloads/connectors/hive/odbc/2-5-12.html
http://hortonworks.com/hadoop-tutorial/how-to-install-and-configure-the-hortonworks-odbc-driver-on-windows-7/
How do I connect SQL server 2012 with php 5.6.3?
Like in mysql I use phpMyAdmin, how is it done in SQL server 2012?
Where do I have to save the database?
Nothing changes much while using different database service.
You can use Microsoft SQL Server Management Studio 2012 to create and manage your database.
Databases are automatically saved to SSMS's ( SQL Server Management Studio ) default location. But they can be easily transferred to different location by copying .mdf and .ldf files.
While using php ( or any other language ), make sure to keep running SQL Server Service and use proper connection String to connect to database.
Connecting to database
If you are on windows, use sqlsrv extension and do not forget install SQL Server Native Client 2012. sqlsrv supports also PDO - just use right connection string. On unix try to use mssql or odbc extension.
phpMyAdmin alternatives
SSMS (SQL Server Management Studio 2012) - tool that you can use but it is more for database administrators than developers.
SSDT (SQL Server Development Tool) - similar to SSMS but it is also capable to creating snapshots, comparing schemas, data-tier apps and much more. It is a part of Visual Studio or as standalone app.
Administration
SQL Server is a little bit more sofisticated database than MySQL. Database files are stored in Program Files by default (.mdf for database files, .ldf for transactions log). All administrator tasks, that you want to make as developer, could be done from SSMS (not from configuration file).
I'm searching for a solution to connect to a Database (no matter the provider), with PHP.
BUT, I don't want to use the ODBC drivers.
I found that OLE DB is an alternative, but what are the possibilities if I want to use nix?
Does anyone know why mssql_connect would be slow? PHP is running on a Linux server with FreeTDS. I am trying to connect to a remote database. When I connect from PHP it takes about 3 seconds, but if I use the FreeTDS tsql command from the shell it connects in under a second, so it is able to connect faster. Is there a setting I can change or a different driver I should use?
You should start using PDO with MSSQL driver support.
More info on:
http://php.net/manual/en/ref.pdo-dblib.php
And some examples:
Connecting to mssql using pdo through php and linux