I have installed PDO_INFORMIX and CSDK already on CentOS5.6 32bits
and index.php have
<?php
error_reporting(E_ALL);
ini_set("display_errors", 1);
$db = new PDO("informix:host=172.30.179.81; service=5000;database=cms; EnableScrollableCursors=1", "myuser", "mypassword");
print("OK");
?>
but i still got this error
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE=HY000, SQLDriverConnect: -11060 [Informix][Informix ODBC Driver]General error.' in /usr/local/apache/htdocs/index3.php:5 Stack trace: #0 /usr/local/apache/htdocs/index3.php(5): PDO->__construct('informix:host=1...', 'myuser', 'mypassword') #1 {main} thrown in /usr/local/apache/htdocs/index3.php on line 5
Have anyone know what it is ?
Thanks
Ouch! The standard technique for finding out more about errors is:
$ finderr -11060
-11060 General error.
An error occurred that has no specific SQL_STATE. In this case,
additional text is provided that identifies the source of the problem.
This IBM Informix CLI error code is the same as SQLSTATE value S1000.
$
That is not very helpful - to be polite about it.
There are spaces in the connect string; does removing them help at all?
Can you telnet to the host 172.30.179.81?
Can you telnet to the port (service) 5000 on the host?
Can you connect from this machine using any other Informix tool?
Can you connect from other machines using the same connect string?
In case of desparation, can you track down whether all the shared libraries are loading correctly?
Related
I know that I have seen this question before but have not seen an answer that has been able to fix the issue on my machine.
I'm relatively new to PHP and have no experience with Apache settings.
I am using the latest version of MAMP (not pro) with all the default settings on the latest version of OS X (10.3.3).
When I try to connect via PDO I receive the following error:
Unable to connect to the database server.exception 'PDOException' with message 'SQLSTATE[HY000] [2002] No such file or directory' in /Applications/MAMP/htdocs/resources/config.php:7 Stack trace: #0 /Applications/MAMP/htdocs/resources/config.php(7): PDO->__construct('mysql:host=loca...', 'USERNAME', 'PASSWORD') #1 /Applications/MAMP/htdocs/WEBSITE/index.php(2): include_once('/Applications/M...') #2 {main}
The connection code is from Kevin Yank's Novice to Ninja book, modified to apply to my database, username, etc.
try
{
$pdo = new PDO('mysql:host=localhost;dbname=db', $DBUser,$DBPass);
}
catch (PDOException $e)
{
$error = 'Unable to connect to the database server.' . $e;
include 'error.html.php';
exit();
}
I have tried localhost and 127.0.0.1 and get the same error regardless.
I don't see anything in Console that could help but I may not be looking for the right thing.
Any help is appreciated. Thanks
try this command in mac
ln -s /Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql.sock
This could happen if mysqld is not running (stuff happens). It could also happen if you have a configuration error.
For example, on my installation, i reproduce the error with this DSN :
mysql:unix_socket=/tmp/mysqle.sock;dbname=notifications;charset=utf8
the config calls for /tmp/mysql.sock
Check the config to see what method is configured (port or socket) and which (port or socket). If you have the wrong port or socket in your DSN, you will produce the same error report in the question.
I got error ( Fatal error: Uncaught exception 'PDOException' with message 'could not find driver' in C:\wamp\www\test.php on line 30) when i run my php page using wamp server.
First I introduce the technology i used.
1) Adobe dreamviewer CS6
2) WAMP server 2.0
3)IBM Informix 64 bit
Steps i followed
Install IBM Informix 64 bit
make ODBC connection (System DNS) successsful
download php_pdo.dll and php_PDO_Informix.dll and paste these .dll on "C:\wamp\bin\php\php5.4.12\ext"
add below lines in php.ini below extension
extension=php_pdo.dll
extension=php_pdo_informix.dll
*create below php code for connection test with IBM informix
<?php $db = new PDO("informix:host=10.81.32.12; service=1504;
database=db_cra; server='servername'; protocol=onsoctcp;
EnableScrollableCursors=1", "Userid", "Pasw") or die("Could not connect to data); ?>
restart WAMP server and execute this page
then i got this Fatal error: Uncaught exception 'PDOException' with message 'could not find driver'
Please help..I'm totally new for this Technology,
Let me know any thing you require from my side.
Perhaps try with a DSN? http://php.net/manual/en/ref.pdo-informix.connection.php
$db = new PDO("informix:DSN=Infdrv33", "", "");
where Infdrv33 is replaced by the name of the System DSN you tested.
I'm trying to connect to a Foxpro database using the OLE DB Driver
I downloaded the driver from http://www.microsoft.com/en-us/download/details.aspx?id=14839 and installed it then create a php script
$conn = new COM("ADODB.Connection") or die("Cannot start ADO");
$conn->Open("Provider=vfpoledb.1;Data Source=C:\Opera3\Comp_I.DBC;Collating Sequence=machine");
This gives me the following error
Fatal error: Uncaught exception 'com_exception' with message '<b>Source:</b> ADODB.Connection<br/><b>Description:</b> Provider cannot be found. It may not be properly installed.' in C:\inetpub\wwwroot\test1.php:4 Stack trace: #0 C:\inetpub\wwwroot\test1.php(4): com->Open('Provider=vfpole...') #1 {main} thrown in C:\inetpub\wwwroot\test1.php on line 4
Any help in getting this working would be much appreciated.
As requested
uninstalled and reinstalled from command line as administrator for all users and now it works –
i have PHP Version 5.2.8 on my windows 2003 server, i am trying to connect with database
$dbh = new PDO("mysql:host=localhost;port=3306;dbname=$db_name", $db_user, $db_pass);
but when i use this statement i got following error
Fatal error: Uncaught exception 'PDOException' with message 'could not find driver'
in bin\db.php:14 Stack trace: #0 bin\db.php(14):
PDO->__construct('mysql:host=loca...', 'root', '123') #1
main.php(4): include_once('C:\Inetpub\wwwr...') #2
{main} thrown in bin\db.php on line 14
how can i fix this problem?
Thanks
You must remove the ; on this line in php.ini :
;extension=php_pdo_mysql.dll
extension=php_pdo_mysql.dll
If you're upgrading PHP, be sure to check your environment variable information, especially your `PATH, and reboot if you change it.
I was using a php.ini file from a different directory. As Sebastian Grignoli suggests, check your phpinfo() results for the location of the php.ini it's using.
I need to connect to a MS SQLServer 2008 service from PHP on Ubuntu, and I would like to do so using PDO. I believe I have installed all the prerequisite libraries, and I am indeed able to connect using tsql on the command line and using mssql_connect() in code. I can't figure out what the proper DSN is, or if there are any additional PDO-specific configuration steps I am missing.
I am using the following DSN (where $db* variables are populated with their appropriate values):
odbc:Driver=FreeTDS;SERVER=$dbServer;DATABASE=$dbSchema;UID=$dbUser;PWD=$dbPasswd"
My error message is:
PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[IM002] SQLDriverConnect: 0 [unixODBC][Driver Manager]Data source name not found, and no default driver specified' in /home/timothy/test.php:4
Stack trace:
#0 /home/timothy/test.php(4): PDO->__construct('odbc:Driver=Fre...')
#1 {main}
thrown in /home/timothy/test.php on line 4
What additional configuration steps have I over looked?
Thanks in advance.
You shouldn't need any additional configuration if you can connect with tsql and the mssql extension. You probably just don't have the correct dsn. This documentation should help. Try new PDO("dblib:host=xx.xx.xx.xx;dbname=mydatabase", "username", "password");