Connect to AS400 via PHP - Which adapter - performance? - php

Next month I need to develop a script to connect to an AS400 and query some data (>1000000). I want to do this with PHP, as I am doing a lot with PHP.
My question know is, how should I connect to the As400. I know that there is ODBC, but everyone said to me ODBC is sub-optimal because it cannot handle large dataset with a great performance. Everyone recommends me JDBC.
So what do you recommend me. What would you use if you get this task... I do not plan to switch the programming language if it is not as must.

I don't know about performance on ODBC and if there are differences based on the platform you are running it against, but I believe ODBC is the only way you can connect to the i with PHP if you are using PHP on a remote server. I do know that the i can handle large amounts of data much better than most other SQL database servers.
You could also ask this question on Web400 at Midrange.com. There are several on that list that use PHP and there are even a couple of people from Zend on the list that could help you out.

The IBM i (current name of platform) has database drivers for .NET and Java.
It may be that the DB2 universal driver for your platform can connect to the system, but I do not have personal experience with that.

Related

PHP connection to sharepoint database: MSSQL 2005 ODBC Driver or Webservices?

I'm trying to connect a web portal coded in PHP to a Sharepoint database. I researched and there are 2 possible options to use: MSSQL 2005 OBDC Driver and Webservices.
Which of this 2 options is the better one, and why?
https://technet.microsoft.com/en-us/library/cc793139(v=sql.90).aspx
This is an easy answer. The answer is the web services because directly querying SharePoint's databases is not allowed from a supportability standpoint (reference: https://blogs.msdn.microsoft.com/brian_farnhill/2013/12/04/directly-querying-sharepoint-databases/)
To summarize some of the core arguments is that directly talking to the database (even if it is just reads) introduces unpredictable locking of database resources which will cause problems. On top of this, the Content Database schema is not the best of my knowledge formally documented and of course subject to frequent changes. If you've ever peered inside you'll see that it is quite complicated and thus difficult to come up with generic SQL to get the data you want. The API (and therefore the web services) have done the hard work to give you a generic interface into SharePoint and to hide the complexity.
Lastly, if you are at all thinking about modifying SharePoint you are an absolute glutton for pain if you think about using direct SQL.

MSSQL -> MySQL or PostgreSQL DB replication

I find myself in a situation that someone else must have got stuck in at some point.
Our company runs an in house MSSQL based database, our website then sits on an external server and currently runs MySQL. The problem comes that both databases need to communicate with each other increasingly often.
Our current solution involves SSIS packages but they are tempromental and often slow. We end up very often having to drop tables on our live production server before then rebuilding them from the in house server. Of course this is leading to data inconsistencies so we try and perform these operations outside of peak hours. However, this leads to 24hr delays in some data being transferred from MySQL to MSSQL and then an additional 24hr delay in getting it back to MySQL. None of this is ideal.
What I am looking for is a solution that will allow replication between our in-house MSSQL server and any database that can sit upon a linux box and play nicely with PHP. As I said, we currently run MySQL so we have a preference to any solution that would include that but all other suggestions would be greatfully received.
I've read somewhere that PostgreSQL is a vialbe solution but I am now struggling to find where I read that. I've come accross a few tools that might help such as DBMoto and Slony-I, does anyone have any experience of either in such a situation?
Alternatively, are we simply barking up the wrong tree altogether and should we be trying to integrate MSSQL into our PHP environment?
Any thoughts or suggestions would be gratefully recieved.
Many thanks
Rob
The best solution that i know and i have used for this kind of job is SymmetricDS .
SymmetricDS is an asynchronous data replication software package that
supports multiple subscribers and bi-directional synchronization.
You can access MSSQL servers from PHP using FreeTDS and the mssql_* family of functions (or classes built thereon, or alternative freetds-using extensions). We use this for our admin application, with a Linux/PHP website talking to a MSSQL database.

Cassandra PHP interface with CQL available/planned?

I'm trying to plan a web application that should use a noSQL solution - Cassandra seems to be a good solution. I saw there are libraries for PHP to manipulate the database like phpCassa.
Also I saw the new version of Cassandra 0.8 is introducing a query language CQL.
Are there php interfaces that use the CQL? What is the benefit using the CQL? Is it just a more sql-like way to make queries?
Thank you!
The link Greg posted above is to date the working repo and state of the php-cql driver efforts.
While a driver is not yet available it does not stop you from using CQL, the drivers are all going to be a wrapper of the thrift method "execute_cql_query" (Until a new transport is created anyway).
That means you can simply compile thrift for php or get it from an updated project and then pass your cql query to that method. It does mean manual handling of things that a driver will/should take care of.
"Is it just a more sql-like way to make queries?", basically...yes. One of the things that came up on the Cassandra mailing list was getting CQL to be as SQL-Like as possible.
"What is the benefit using the CQL?" Well, mainly that some new Cassandra users find the thrift API tedious to get to grips with, CQL may be much easier to learn since its is so close to the "normal" sql.
https://github.com/nicktelford/php-cql
I also believe that phpCassa should support it as well.
It's designed to make NoSQL more logical for people coming from SQL as a database engine.
This will really be helpful if you wish to use CQL to communicate with Cassandra via PHP
https://gist.github.com/1024060/983a5607390433b77d5c2e64a4ee148f4df46b69
This is a sample of what zcourts mentioned in his previous post
Regards,
Tamil
The official CQL drivers supported by the Apache Cassandra project at large are, I believe, all on Apache Extras, at this link:
http://code.google.com/a/apache-extras.org/hosting/search?q=label:cql
The PHP one is at
http://code.google.com/a/apache-extras.org/p/cassandra-pdo/
Connection via Thrift deprecated.
I am using PHP library for Cassandra database via a binary protocol.

Remote database management from local development server

I am looking for a way to access and query my remote databases from my local server.
Something like PhpMyAdmin, but little more versatile.
So that I can feed it with databases I would like to see, store my queries (or better, if it has ways to access simple queries built in itself)
Can someone help me with such a PHP Script (or Class)?
Regards
Nikhil Gupta
I think it would be better to use a MySQL client instead.
I have been using sqlyog's community edition for years. It has a quick startup, and allows you to connect to multiple servers at the same time.
http://code.google.com/p/sqlyog/downloads/list
One of my favorite features is the ability to copy databases from one server to another.
( Yes, you could do this via the CLI, but having a GUI is handy. )
If it's ok to run as windows-programs, here are two suggestions:
Dbvisualizer http://www.dbvis.com/
Visual studio (even express versions) has what they call "database explorer", just install some mysql-connector that VS can handle, like odbc.
PHP has full support for mysql databases. See http://www.php.net/manual/en/ref.msql.php. Just use the address for your remote server when opening the connection.

Is it possible to connect PHP to SQL Server Compact Edition?

Is it possible to connect PHP to a SQL Server Compact Edition database? What would be the best driver?
I need it for a desktop application where SQL Server Express is too heavy.
Short Answer : No.
Long Answer : To my knowledge, unlike PostgreSQL / MySQL / MS-SQL, there is no native driver to connect PHP to SQL Server Compact Edition.
If you want to connect to it, your best bet is to use PHP ODBC connections to talk to a ODBC Driver connected to the SQL Compact server. But its pretty much a hack, and you'd be crazy to use this kind of thing for anything remotely important.
If you are worried about SQL Server Express being too heavy, use MySQL with MyISAM tables. It's pretty fast and lightweight. Emergent has a good checklist of things to configure / disable to make MySQL even faster and use less resources.
Relevant links :
MSDN Post asking the same question
Erik EJ's blog - SQL Compact with OLE DB
You could also consider SQLite:
http://www.devshed.com/c/a/PHP/Introduction-to-Using-SQLite-with-PHP-5/
I've used the php-odbtp to interface PHP (with ADOdb) to a MS SQL server and it runs well, even across remote networks.
It provides a tunneling protocol from a non-odbc platform (Linux) to a service installed on the Win32 machine to buffer requests to and from an ODBC connection. Bit of a pain to setup the first time, at least 2-3 years ago when I first used it. Should also work fine for Win32<->Win32 applications.
Not familiar with SQL C.E., but I'd imagine it supports an ODBC connection of some sort, and the standard T-SQL commands.
I wrote a php class that handles SQL compact edition files using the COM object of PHP.
This means it will only work on Windows based machines where the SQL Compact Edition runtime is installed.
You can download here (article is in German, link is at the bottom) with an example database file and script
http://www.klemmkeil.de/sql-compact-edition-sdf-mit-php-auslesen/
The question is Why? Why not just use an Express Version?
I must say that I'm curious, but I can't say that I've used a C.E. data base for anything outside of a .Net application that had the assemblies in the application folder.

Categories