Connection PHP to Paradox database - php

I need to make a connection with PHP to a database created with Paradox (about the year 2004, I think). It is a very old database and there is no way to find information online.
I have tried with xampp, wamp but they do not bring by default any library that can read that type of database from PHP. I have read on the internet that xampp (for example) stopped giving support to Paradox on the year 2008. I imagine that wamp the same.
So, does anyone have any experience with this type of database? I would appreciate any kind of guidance on this subject.

I answer to myself in case someone else has to work PHP (4, 5.x, 7...) with the Paradox database and they have this problem too.
The first is to create a connection odbc with the tool: "ODBC data source". This program comes installed in windows by default.
In the tab: "System DSN", optcion "Add".
Search for the connection "Microsoft Paradox Driver (* .db)", accept it. Add a name and select the directory where we have our database.
Finally, edit the php.ini file and add (or uncomment) these lines:
extension = php_odbc.dll
extension = pdo_odbc
With this we will be able to work with paradox databases in any version of PHP.

Related

Connect to a remote Windows Sybase database from Ubuntu via PHP

Ubuntu 12.04 LTS Precise
I'm trying to use PHP to connect to a remote Windows Sybase database. Let us assume Windows 7 Enterprise SP1. I'm currently doing this in PHP:
$db = sybase_connect("10.1.208.111", "$user", "$pass");
And I'm getting an error of:
Warning: sybase_connect(): Unable to connect to server: 10.1.208.111
I understand that the server I'm connecting to (10.1.208.111), needs to be in the interfaces file. I'm trying to figure out where that is, or even if I have one on the Ubuntu server (I'm still new to linux itself). I read that the path for the file is located in the SYBASE environmental variable. I don't know where that is either. Can anyone shed some light? I can offer more information if you need it, I just don't know what you need right off the bat.
PS: The windows machine has Micros RES installed on it. That's the database I'm trying to pull data from. Not sure if that matters.
The default installation directory for Sybase ASE in windows is C:\sybase, so your interfaces (interfaces.ini) should be located there.
For SQL Anywhere, the interfaces file is called SQL.ini, and it's location varies, but you should be able to do a search of your system drive to find it.
For SQL Anywhere you probably want to use the PHP apis that are provide by SAP Sybase. The SQL Anywhere documentation is a pretty good place to start, as it covers all the pieces that need to be installed to get SQL Anywhere to talk to PHP.
SQL Anywhere 11: SQL Anwhere PHP API
You may also be able to find good information over at the SAP Community Network site for SQL Anywhere.

Access DB PDO not working in Windows Server x64 edition

Guys I am really stuck up here with this Access DB. I made a php application for a company, the record exporting to MS access in the web application is giving me headache.
I installed Xampp 1.8.1x32 and MS office 2010 32bit professional in their Windows 2008 64 bit version server, everything is working fine! I enabled extension=php_pdo_odbc.dll in the php.ini and I tried to export data from mysql to accdb file using php PDO, but it's not inserting data into the accdb file.
I even tried adding a system DSN to the accdb file in both ODBC 64bit and ODBC 32bit by installing "Access Database Engine x64" and "Access Database Engine x32", but still out of luck. The same mysql to accdb data exporting is working fine in my win7 x64 and ms office 2010 x32 even without installing access database engine and without setting DSN!
Kindly let me know whether there is some other way out to insert data into accdb using PDO in Win 2008x64 server edition. Should I install any special access database edition in win 2008, or should I enable something to make it work?
Sorry for this lengthy and twisted post :p I didn't find solution anywhere else in the internet. Kindly help!
Update: There is no PDO or php errors displayed. just it's not working!
I experienced the same problems. I was able to read and display records but INSERT had no effect, no error was thrown either. The thing is, I kept trying to execute an SQL statement with the values already filled out. Once I tried the prepare and execute statements with actual parameters it did work. I have no idea why it behaves this way but it seems like you can't directly execute INSERT statements?
Btw I previously tried 'prepare - execute' with no arguments as well ( as the data was filled out in the query already ). Glad it only took me 3 hours of trial and error! :(

Laravel 4 on Mac localhost: Cannot find driver for SQLSRV

I'm trying to connect with Laravel 4 to an SQL Server database. I'm getting an error, but I think it's a PHP error, not a Laravel error. It says PDOException: could not find driver. I have the driver set to sqlsrv like another example in the database.php file. Like I said, I think this is a PHP error, not Laravel.
I'm on localhost on my Mac. Do I need to configure something in my php.ini file? I found another article that said I need to comment out a MySQL driver under PDO. I also couldn't find that line in my php.ini. But I need to connect to a MySQL database as well, anyway. What do I need to change in my php.ini file?
I found this line:
pdo_mysql.cache_size = 2000
But commenting it out did nothing even after restarting Apache.
The sqlsrv driver is a windows-only driver according to the PHP Manual (www.php.net/manual/en/sqlsrv.requirements.php). So you can't use that driver on Mac, Linux, Unix or any other operating system than the ones listed on that page.
I assume you are trying to connect to a remote SQL Server somewhere? If you're on Mac, then SQL Server wouldn't be running on your local machine, so I guess the first question is whether or not you have a SQL Server running somewhere.
Second, from the server that is running PHP, you would need to connect using either FreeTDS or ODBC with FreeTDS.
Since Laravel 4 uses PDO, you'll need to install FreeTDS and ODBC. Laravel 4 doesn't use the mssql PHP extension. It uses PDO, so mssql won't get you anywhere with Laravel 4.
If you're serving PHP from your Mac, I would say there are generally 4 different ways you could go:
The Easy, but costly way: Go to (www.macupdate.com/app/mac/23152/openlink-odbc-driver-for-sybase) and download and install OpenLink ODBC driver. This allows you to create new ODBC connections using the Sybase (MSSQL) driver on a XNIX machine. There's an installation walk-through here (wikis.openlinksw.com/dataspace/owiki/wiki/UdaWikiWeb/InstallSybaseExpressOSX). It comes with a 15 day trial, after which you would have to purchase it. As of this writing, it appears to cost somewhere in the range of $30 - $50 depending on the license you choose.
The harder, but free way: Follow http://blog.benjaminwalters.net/?p=10 (slightly outdated) to re-compile FreeTDS support into PHP on Mac (assuming you're using MAMP)
The far better, but also far more work way: Find a Virtual Machine Host software like VMWare Fusion and install a Linux server like Ubuntu 12.4. Make sure you install apache2 and PHP during the install process and then follow the steps here to get FreeTDS working on your new server machine.
Run PHP from the Windows Server that is running SQL Server
Milage will vary with each solution, and there is a learning curve in any case. I've been a PHP developer for a long time, and it took me days to figure out how to get connected to SQL Server for the first time from Linux. Thankfully, there are quite a few walkthroughs out there now, and FreeTDS has come a long way since that time.
Hope that helps. :)
I actually have this running on my setup. My best advice is to get on the Homebrew bus.
https://github.com/josegonzalez/homebrew-php is where you're going to want to look for installing PHP and related items. I don't remember exactly what I did but it wasn't particularly difficult.
First you'll need FreeTDS.
brew install freetds
Then, add Jose's formulas to your homebrew (instructions on the github page). After that,
brew install php5x --with-mssql
brew options php5x
if you need more extensions.
Based on Jon Watson's comment,
I've tried step 2, and it doesn't work. check my issue here https://github.com/laravel/laravel/issues/2180
Step 3 is broken link and I think it's the same with step 2.
I also tried linux ODBC driver for Laravel (there are 2, google it), both doesn't work too. Although my simple test php works in both DBLIB and ODBC (compiled using official microsoft odbc unix driver).
Step 4 definitely works, BUT you must use IIS for best stability.
That leaves step 1. OR,
Ditch Laravel4 and use good ol' AdoDB http://adodb.sourceforge.net/ which I've been using since 2006 and still working superbly (although not modern like Laravel) configure it using tutorial in http://docs.moodle.org/20/en/Installing_MSSQL_for_PHP
I wonder why they don't build sqlsrv driver for linux too....

Connect PHP with Paradox .db file on linux server

I have the following situation:
I have to integrate a website (php on linux server) with an old app (Delphi and Paradox (.db file) on Windows)
I need get data from paradox database and show them in the website. I can get transfer the .db file by FTP.
I don't think that I can install external libraries.
I did not find any command line program on Windows to convert from .db file to mysql or any format that supports PHP.
In addition, Paradox database is updated daily.
Does anyone have any solution or tip or anything?
Probably best is to write a new stand-alone application for the Windows host that is linked against both the Paradox libraries and the PostgreSQL libraries; make queries against the Paradox database and write the data to the PostgreSQL database.
If you wanted to go half-way and write a tool that dumps the Paradox database into a CSV format for later import on the PostgreSQL end, that could work too, but there is enough hassle in CSV formats that doing the entire transition Paradox -> PostgreSQL in one application seems like the best approach to me.
I found here the solution to get data from a paradox .db file without DBE.
Regards.

How to migrate from my WAMP environment to using MSSQL?

I have on my local PC installed WAMP environment (using WampServer OS).
Now I would need to change one script from working with MySQL to MSSQL.
I have no idea at all how to proceed, where to download MSSQL, how to install it and how to connect with PHP?
Thank you very much
Download mssql express http://www.microsoft.com/Sqlserver/2005/en/us/express.aspx
Familiarize yourself with one of the great database abstraction layers, for example PDO http://www.php.net/pdo
Refactor your code to use the database abstraction layer
You may need to rewrite the mysql specific things to "standard" SQL
Start by getting Sql Server working. If you are using an old copy of Sql Server (pre 2005) you will need to make sure ntwdblib.dll is present in your System32 directory, and removed from your PHP dll directory (ntwdblib.dll is installed with the enterprise tools, so you may have to install them on your PHP box as well). Once you have Mssql querying properly, start finding where Mssql differs from MySql in your code.
A couple of tips:
The ntwdblib doesn't accept long strings (I think it is limited to 4k, but don't quote me on that). You have to use Stored Procs if you are trying to process a string longer than 4k.
Try to use Sql Server 2005 if you can (see above), the ntwdblib.dll is ancient and has numerous issues.
The PHP site is your friend for mssql.

Categories