Author Topic: PDO Error  (Read 36013 times)

hauntmisery

  • Newbie
  • *
  • Posts: 3
PDO Error
« on: August 24, 2007, 09:26:12 pm »
Im getting a PDO error i looked at the others and nothing helped. I have everything setup. Here is my error.

sh loadInitData.sh
August 24, 2007, 11:23:33 pm - Loading init data...<br>
PHP Fatal error:  Uncaught exception 'PDOException' with message 'There is no active transaction' in /var/www/html/CalemEAM/server/include/core/database/CalemPdo.php:201
Stack trace:
#0 /var/www/html/CalemEAM/server/include/core/database/CalemPdo.php(201): PDO->rollBack()
#1 /var/www/html/CalemEAM/server/setup/CalemDataLoader.php(111): CalemPdo->rollback()
#2 /var/www/html/CalemEAM/server/setup/CalemDataLoader.php(140): CalemDataLoader->updateRecord(Object(CalemTableDd), Array)
#3 /var/www/html/CalemEAM/server/setup/CalemDataLoader.php(176): CalemDataLoader->loadFile(Object(CalemTableDd), '/var/www/html/C...')
#4 /var/www/html/CalemEAM/server/setup/LoadInitDataCmd.php(52): CalemDataLoader->load(Object(CalemDataLoadConf))
#5 {main}
  thrown in /var/www/html/CalemEAM/server/include/core/database/CalemPdo.php on line 201

I am running on CentOS 4.5 with apache 2.0 - php 5.1 - mysql 5

calemadmin

  • Administrator
  • Calem Hero
  • *****
  • Posts: 300
    • http://www.calemeam.com
PDO Error
« Reply #1 on: August 25, 2007, 08:15:01 am »
We ran into a similar issue with openSUSE which complained about no active transaction when running the same script. It was not clear what was the culprit. It might be helpful to post your error in centOS forum.
Calem Community Forum Admin

calemadmin

  • Administrator
  • Calem Hero
  • *****
  • Posts: 300
    • http://www.calemeam.com
PDO Error
« Reply #2 on: August 25, 2007, 08:18:24 am »
Calem Community Forum Admin

csd_joe

  • Newbie
  • *
  • Posts: 3
PDO Error
« Reply #3 on: November 23, 2007, 05:10:21 pm »
I'm having the same troubles as others here have as well.  Tried on both CentOS 5 and Fedora Core 6.  

In both cases I had to change the tables from MyISAM to InnoDB after running the createSchema script, but I still get the same error as before and after the change.  Is there something else that needs to be changed in the database so this will work?  



November 23, 2007, 5:04:12 pm - Loading init data...<br>
PHP Fatal error:  Uncaught exception 'PDOException' with message 'There is no active transaction' in /var/www/html/CalemEAM/server/include/core/database/CalemPdo.php:201
Stack trace:
#0 /var/www/html/CalemEAM/server/include/core/database/CalemPdo.php(201): PDO->rollBack()
#1 /var/www/html/CalemEAM/server/setup/CalemDataLoader.php(111): CalemPdo->rollback()
#2 /var/www/html/CalemEAM/server/setup/CalemDataLoader.php(140): CalemDataLoader->updateRecord(Object(CalemTableDd), Array)
#3 /var/www/html/CalemEAM/server/setup/CalemDataLoader.php(176): CalemDataLoader->loadFile(Object(CalemTableDd), '/var/www/html/C...')
#4 /var/www/html/CalemEAM/server/setup/LoadInitDataCmd.php(52): CalemDataLoader->load(Object(CalemDataLoadConf))
#5 {main}
  thrown in /var/www/html/CalemEAM/server/include/core/database/CalemPdo.php on line 201

calemadmin

  • Administrator
  • Calem Hero
  • *****
  • Posts: 300
    • http://www.calemeam.com
PDO Error
« Reply #4 on: November 26, 2007, 10:20:53 am »
It's not clear to us what caused the error. We had no problem in setting up CalemEAM in Fedora 6 and XAMPP. You may adjust database logging levels and see if there're any clues there.
Calem Community Forum Admin

csd_joe

  • Newbie
  • *
  • Posts: 3
PDO Error
« Reply #5 on: November 26, 2007, 04:28:30 pm »
from calem.log

maybe this has some clues?


2007-11-26 16:14:04,016 DEBUG CalemPdo - Transaction committed by CalemDbo.insert@295
2007-11-26 16:14:04,016 DEBUG CalemDataLoader - Loading data for table for acl_group = acl_group
2007-11-26 16:14:04,016 DEBUG CalemDataLoader - files for acl_group = array (
  0 => '/var/www/html/CalemEAM/server/setup/init/acl_group.php',
)
2007-11-26 16:14:04,016 DEBUG CalemPdo - Transaction started by CalemDbo.insert@292
2007-11-26 16:14:04,016 ERROR CalemAclGroupDbo - Insert exception: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'id' cannot be null, errorInfo: array (
  0 => '23000',
  1 => 1048,
  2 => 'Column \'id\' cannot be null',
)
2007-11-26 16:14:04,016 DEBUG CalemAclGroupDbo - errorInfo=array (
  0 => '23000',
  1 => 1048,
  2 => 'Column \'id\' cannot be null',
), sql=insert into acl_group (  id, acl_group, note, created_id, modified_id, created_time, modified_time) values ( ?, ?, ?, ?, ?, ?, ?), changes=array (
  'id' => true,
  'acl_group' => true,
  'note' => true,
  'created_id' => true,
  'modified_id' => true,
  'created_time' => true,
  'modified_time' => true,
), row=array (
  'id' => 'CUSTOM_SYSTEM',
  'acl_group' => 'Custom system',
  'note' => 'Customization/configuration shared by all other groups',
  'created_id' => 1000000,
  'modified_id' => 1000000,
  'created_time' => '2007-11-26 22:14:04',
  'modified_time' => '2007-11-26 22:14:04',
)
2007-11-26 16:14:04,016 DEBUG CalemPdo - Rollback called by CalemDataLoader.loadFile@134 , transaction stack=CalemDbo.insert@292
2007-11-26 16:14:04,016 WARN  CalemDataLoader - error in inserting 'acl_group', error=array (
  0 => '23000',
  1 => 1048,
  2 => 'Column \'id\' cannot be null',
), row=array (
  'id' => 'CUSTOM_SYSTEM',
  'acl_group' => 'Custom system',
  'note' => 'Customization/configuration shared by all other groups',
)
2007-11-26 16:14:04,016 DEBUG CalemPdo - Transaction started by CalemDbo.update@381
2007-11-26 16:14:04,016 DEBUG CalemPDOStatement - Query time:0.0005, the query=update acl_group set  id = ?, acl_group = ?, note = ?, modified_id = ?, modified_time = ? where id = 'CUSTOM_SYSTEM', params=array (
  1 => 'CUSTOM_SYSTEM',
  2 => 'Custom system',
  3 => 'Customization/configuration shared by all other groups',
  4 => 1000000,
  5 => '2007-11-26 22:14:04',
)
2007-11-26 16:14:04,016 DEBUG CalemPdo - Transaction committed by CalemDbo.update@384
2007-11-26 16:14:04,016 DEBUG CalemAclGroupDbo - Reload cache for acl_group
2007-11-26 16:14:04,016 DEBUG CalemPDOStatement - Query time:0.0005, the query=select * from acl_group, params=NULL
2007-11-26 16:14:04,016 DEBUG CalemPdo - Rollback called by CalemDataLoader.updateRecord@111 , transaction stack=

calemadmin

  • Administrator
  • Calem Hero
  • *****
  • Posts: 300
    • http://www.calemeam.com
PDO Error
« Reply #6 on: November 26, 2007, 07:13:47 pm »
The log implied that PDO binding of 'id' column was not working. Early version of PDO had some binding issues:
http://pecl.php.net/bugs/bug.php?id=6030

You might find out the pdo version and upgrade PDO. I have not find a good way to query PDO version so I included a script below to tell PDO driver's version.

store the following script in a file (say pdover.php), run the script with php.


<?php

$dsn = 'mysql:dbname=calemeam;host=localhost';
$user = 'root';
$password = '';

try {
    $dbh = new PDO($dsn, $user, $password);
} catch (PDOException $e) {
    echo "PDO exception in connecting to db: " . $e->getMessage() . "<br>\n";
}

echo "driver version: " . ($dbh->getAttribute( PDO::ATTR_CLIENT_VERSION)) . "<br>\n";
?>
Calem Community Forum Admin

csd_joe

  • Newbie
  • *
  • Posts: 3
php and pdo version
« Reply #7 on: November 27, 2007, 10:04:57 am »
PHP version 5.1.6
pdo driver version 5.0.22

calemadmin

  • Administrator
  • Calem Hero
  • *****
  • Posts: 300
    • http://www.calemeam.com
PDO Error
« Reply #8 on: November 27, 2007, 07:12:46 pm »
It might be that for your particular installation PDO is not working correctly. I guess you could try upgrading PDO; or if you're open to try out XAMPP 1.6.1 or 1.6.4 (the latest). We tested XAMPP 1.6.1 with CalemEAM on Fedora 6. It has PHP v5.2.1 and pdo_mysql version 5.0.37.
Calem Community Forum Admin

calemadmin

  • Administrator
  • Calem Hero
  • *****
  • Posts: 300
    • http://www.calemeam.com
PDO Error
« Reply #9 on: December 08, 2007, 04:31:44 pm »
The error of "No active transaction" was resolved on a machine with different system setup. The machine is running Fedora Core 7 (about to become Fedora 8), with the latest PHP, Apache, MySQL, PEAR, all that.  There were no errors when running the scripts.  

However the other two machines (FC6 and Centos5) still error out when trying to setup and install the database. CalemEAM would recommend using the latest XAMPP package on those machines.
Calem Community Forum Admin

fred

  • Newbie
  • *
  • Posts: 8
Re: PDO Error
« Reply #10 on: December 16, 2007, 10:45:21 pm »
Quote from: "hauntmisery"
Im getting a PDO error i looked at the others and nothing helped. I have everything setup. Here is my error. I am running on CentOS 4.5 with apache 2.0 - php 5.1 - mysql 5



I am running CentOS 5.1 and I am getting the same PDO error. I think that suggesting that one move from a production/stable software to one using beta software removes any vestige of "Enterprise" class of software. This software should work with CentOS 5.1 as it is a direct copy of RHEL 5.1.

I had to invoke the sql by hand in order to get the createSchema.sh to work. The three statemens that created the database, created the user and assigned rights to the user all failed inside the script. Trying to figure out this PDO error is painful if one has to step through the code.

I would encourage the developers to expand their range of test OS's to include both RHEL and Suse (the Enterprise version).

calemadmin

  • Administrator
  • Calem Hero
  • *****
  • Posts: 300
    • http://www.calemeam.com
PDO Error
« Reply #11 on: December 18, 2007, 03:24:23 pm »
Your suggestions make sense to us. A mantis issue as a community project is added to track this issue.

http://www.calemeam.com/apps/mantis/view.php?id=81
Calem Community Forum Admin