Question

We need to access a Teradata database via php application We don't have odbc (unixodbc etc) on the server.

How might one go about connecting to a teradata database quickly.

Keep in mind - this app needs to be as portable as possible.

Was it helpful?

Solution

This method would help you if u are ok with the memory implications and this would help you if you have teradata command line utility BTEQ installed on your machine.

But better method would be by ODBC as it gives you the flexibility. In the above method of command line execution of SQL scripts by system() function, you can use an easier language like R for parsing the output resultset.

I think you may also do it by jdbc connection. You can also download any of these odbc/jdbc drivers from this link.

OTHER TIPS

Teradata provides an ODBC driver. Once installed, it can be accessed via the unixODBC driver manager, assuming your php was built with "--with-unixODBC=shared,/usr".

PHP can then connect to a Teradata database with odbc_connect($dsn, $user, $passwd);

The Teradata ODBC driver installation includes a sample odbc.ini file, which you can cp to .odbc.ini in your home directory, then modify to contain the DSN for your Teradata database.

Set the environment variable ODBCINI to the location of your odbc.ini file to use (/home/johndoe/.odbc.ini is common).

Be warned: the Teradata ODBC driver provides a rich set of DML statements, but very few are exposed through the unixODBC driver manager. The collection of PHP's odbc_xxxx() functions is a crippled subset of what the Teradata ODBC driver offers.

You may be out of luck.

  • PDO doesn't have a native driver
  • ADODb doesn't have a native driver

judging from what I find from a cursory web search, I'd say it is not possible to connect from PHP to a Teradata database without ODBC.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top