TimeTrex is unable to connect to its database, please make s

General support regarding TimeTrex, such as
configuring policies/taxes or processing payroll.
Post Reply
gregory
Posts: 102
Joined: Fri Oct 28, 2011 3:39 pm

TimeTrex is unable to connect to its database, please make s

Post by gregory »

Getting erro: TimeTrex is unable to connect to its database, please make sure that the database service on your own local TimeTrex server has been started and is running. If you are unsure, try rebooting your server.

Can login Ok, can edit employee details. Get this message when adding punch.

Mysql 5.5.40
PHP 5.3.17

No clue as I believe if we had a real connection issue it would not allow login. User has ALL right to the database.

Thanks,

Gregory
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Re: TimeTrex is unable to connect to its database, please ma

Post by shaunw »

gregory
Posts: 102
Joined: Fri Oct 28, 2011 3:39 pm

Re: TimeTrex is unable to connect to its database, please ma

Post by gregory »

Additional info:
TimeTrex V8.0.1

from timetrex.log
DEBUG [L0065] [289ms]: DBError::__construct(): mysqli error: [1062: Duplicate entry '177424' for key 'PRIMARY'] in adodb_throw(INSERT INTO user_date_total ( ID, USER_ID, PAY_PERIOD_ID, DATE_STAMP, OBJECT_TYPE_ID, PAY_CODE_ID, PUNCH_CONTROL_ID, BRA
DEBUG [L0065] [289ms]: DBError::__construct(): NCH_ID, DEPARTMENT_ID, JOB_ID, JOB_ITEM_ID, QUANTITY, BAD_QUANTITY, START_TYPE_ID, START_TIME_STAMP, TOTAL_TIME, ACTUAL_TOTAL_TIME, TOTAL_TIME_AMOUNT, TOTAL_TIME_AMOUNT_WITH_BURDEN, CREATED_DATE, CREA
DEBUG [L0065] [289ms]: DBError::__construct(): TED_BY, UPDATED_DATE, UPDATED_BY ) VALUES ( 177424, 1, 142, '2015-02-25', 10, 0, 33861, 0, 0, 0, 0, 0, 0, 10, '2015-02-25 12:00:00', 0, 0, 0, 0, 1424888950, 1, 1424888950, 1 ), )
DEBUG [L0065] [289ms]: DBError::__construct():
DEBUG [L0073] [289ms]: DBError::__construct(): End Exception...

from debug

Debug Buffer ============================================================================ Memory Usage: 26249008 Buffer Size: 249 ---------------------------------------------------------------------------- DEBUG [L0438] [2ms]: [Function](): URI: /TimeTrex/api/json/api.php?Class=APIPunch&Method=setPunch&v=2&MessageID=69ace86e-17d3-55e8-6455-943a0759518f IP Address: 192.168.2.32 DEBUG [L0441] [2ms]: [Function](): Version: 8.0.1 Edition: 10 Production: 0 Database: Type: mysqli Name: timetrex Config: /srv/www/htdocs/TimeTrex/includes/../timetrex.ini.php Demo Mode: 0 DEBUG [L0163] [13ms]: TTDate::setTimeZone(): Setting TimeZone: America/Puerto_Rico DEBUG [L0220] [14ms]: [Function](): Handling JSON Call To API Factory: APIPunch Method: setPunch Message ID: 69ace86e-17d3-55e8-6455-943a0759518f DEBUG [L0255] [14ms] Array: [Function](): Arguments: (Size: 382) array(1) { [0]=> array(1) { [0]=> array(15) { ["status_id"]=> int(10) ["type_id"]=> int(10) ["user_id"]=> int(1) ["punch_time"]=> string(5) "12:00" ["branch_id"]=> int(0) ["department_id"]=> int(0) ["job_id"]=> int(0) ["job_item_id"]=> int(0) ["company"]=> string(14) " Caribe SRL" ["punch_date"]=> string(10) "2015-02-25" ["disable_rounding"]=> bool(false) ["note"]=> bool(false) ["station_id"]=> bool(false) ["punch_image"]=> bool(false) ["time_stamp"]=> bool(false) } } } DEBUG [L0264] [17ms]: [Function](): Session ID: 62bb33cd45c496980ff67c47bbb26e2b6dcac723 Source IP: 192.168.2.32 DEBUG [L0734] [17ms]: Authentication::Check(): Session ID: 62bb33cd45c496980ff67c47bbb26e2b6dcac723 IP Address: 192.168.2.32 URL: /TimeTrex/api/json/api.php?Class=APIPunch&Method=setPunch&v=2&MessageID=69ace86e-17d3-55e8-6455-943a0759518f Touch DEBUG [L0734] [17ms]: Authentication::Check(): Updated Date: 1 DEBUG [L0163] [172ms]: TTDate::setTimeZone(): Setting TimeZone: America/Santo_Domingo DEBUG [L0204] [172ms]: TTDate::setDateFormat(): Setting Default Date Format: Y-m-d DEBUG [L0218] [172ms]: TTDate::setTimeFormat(): Setting Default Time Format: G:i DEBUG [L0232] [172ms]: TTDate::setTimeUnitFormat(): Setting Default Time Unit Format: 10 DEBUG [L0120] [173ms]: authenticatedInvokeService(): Locale Cookie: DEBUG [L0128] [173ms]: authenticatedInvokeService(): User Preference Language matches cookie! DEBUG [L0417] [174ms]: TTi18n::setLocale(): Set Master Locale To: en_US DEBUG [L0436] [184ms]: APIPunch::setPunch(): Received data for: 1 Punchs DEBUG [L0437] [184ms] Array: APIPunch::setPunch(): Data: array(1) { [0]=> array(15) { ["status_id"]=> int(10) ["type_id"]=> int(10) ["user_id"]=> int(1) ["punch_time"]=> string(5) "12:00" ["branch_id"]=> int(0) ["department_id"]=> int(0) ["job_id"]=> int(0) ["job_item_id"]=> int(0) ["company"]=> string(14) " Caribe SRL" ["punch_date"]=> string(10) "2015-02-25" ["disable_rounding"]=> bool(false) ["note"]=> bool(false) ["station_id"]=> bool(false) ["punch_image"]=> bool(false) ["time_stamp"]=> bool(false) } } DEBUG [L0093] [185ms]: ProgressBar::start(): start: '69ace86e-17d3-55e8-6455-943a0759518f' Iterations: 1 Update Iterations: Key: 69ace86e-17d3-55e8-6455-943a0759518f(1424888950.4554) Message: DEBUG [L1661] [189ms]: Factory::StartTransaction(): StartTransaction(): Transaction Count: 0 Trans Off: 0 DEBUG [L0492] [190ms] Array: APIPunch::setPunch(): Data: array(15) { ["status_id"]=> int(10) ["type_id"]=> int(10) ["user_id"]=> int(1) ["punch_time"]=> string(5) "12:00" ["branch_id"]=> int(0) ["department_id"]=> int(0) ["job_id"]=> int(0) ["job_item_id"]=> int(0) ["company"]=> string(14) " Caribe SRL" ["punch_date"]=> string(10) "2015-02-25" ["disable_rounding"]=> bool(false) ["note"]=> bool(false) ["station_id"]=> bool(false) ["punch_image"]=> bool(false) ["time_stamp"]=> bool(false) } DEBUG [L0496] [190ms]: APIPunch::setPunch(): Setting object data... DEBUG [L2151] [190ms]: PunchFactory::setObjectFromArray(): Setting User ID: 1 DEBUG [L0402] [190ms]: PunchFactory::setStatus(): Status: 10 DEBUG [L0532] [190ms]: PunchFactory::roundTimeStamp(): Rounding Timestamp: 2015-02-25 12:00(1424880000) Status ID: 10 Type ID: 10 DEBUG [L0540] [194ms]: PunchFactory::roundTimeStamp(): Round Interval Punch Type: 40 User: 1 Total Records: 0 DEBUG [L0895] [194ms]: PunchFactory::roundTimeStamp(): NO Rounding Policy(s) Found DEBUG [L0898] [194ms]: PunchFactory::roundTimeStamp(): Rounded TimeStamp: 2015-02-25 12:00(1424880000) Original TimeStamp: 2015-02-25 12:00 DEBUG [L0937] [194ms]: PunchFactory::setTimeStamp(): Set: 1424880000 DEBUG [L0311] [196ms]: PunchFactory::findPunchControlID(): Checking for incomplete punch control... User: 1 TimeStamp: 1424880000 Status: 10 DEBUG [L0207] [196ms]: PunchControlListFactory::getInCompletePunchControlIdByUserIdAndEpoch(): Epoch: 2015-02-25 12:00 DEBUG [L0057] [200ms]: PunchListFactory::getPayPeriodMaximumShiftTime(): cPay Period Schedule Maximum Shift Time: 57600 DEBUG [L0319] [201ms]: PunchControlListFactory::getInCompletePunchControlIdByUserIdAndEpoch(): Returning FALSE No Valid Gaps Found... DEBUG [L0317] [201ms]: PunchFactory::findPunchControlID(): Couldnt find already existing PunchControlID, generating new one... DEBUG [L0322] [202ms]: PunchFactory::findPunchControlID(): Punch Control ID: 33861 DEBUG [L2224] [202ms]: PunchFactory::setObjectFromArray(): Setting Punch Control ID: 33861 Was passed: DEBUG [L2241] [204ms]: PunchFactory::setObjectFromArray(): Setting actual/original timestamp: 1424880000 DEBUG [L0600] [204ms]: Factory::setCreatedAndUpdatedColumns(): Set created/updated columns... DEBUG [L1678] [204ms]: Factory::isValid(): Calling Validate() DEBUG [L0521] [234ms]: APIPunch::setPunch(): Saving data... DEBUG [L1661] [234ms]: Factory::StartTransaction(): StartTransaction(): Transaction Count: 1 Trans Off: 1 DEBUG [L1727] [234ms]: Factory::Save(): Calling preSave() DEBUG [L1856] [234ms]: PunchFactory::preSave(): Setting Original TimeStamp: 1424880000 DEBUG [L1678] [234ms]: Factory::isValid(): Calling Validate() DEBUG [L1765] [235ms]: Factory::Save(): Insert ID: 21587 Table: punch DEBUG [L1639] [235ms]: Factory::getInsertQuery(): Insert DEBUG [L1661] [241ms]: Factory::StartTransaction(): StartTransaction(): Transaction Count: 1 Trans Off: 2 DEBUG [L1727] [241ms]: Factory::Save(): Calling preSave() DEBUG [L1765] [242ms]: Factory::Save(): Insert ID: 248075 Table: system_log DEBUG [L1639] [242ms]: Factory::getInsertQuery(): Insert DEBUG [L1671] [244ms]: Factory::CommitTransaction(): CommitTransaction(): Transaction Count: 1 Trans Off: 3 DEBUG [L0178] [244ms]: LogDetailFactory::addLogDetail(): System Log ID: 248075 Class: PunchListFactory DEBUG [L0428] [245ms]: LogDetailFactory::addLogDetail(): Logged detail records in: 0.00059294700622559 DEBUG [L1817] [245ms]: Factory::Save(): Calling postSave() DEBUG [L1759] [245ms]: PunchFactory::getImageFileName(): Punch Image File Name: /var/timetrex/storage//punch_images/1/1/11/18/49/21587.jpg Company ID: 1 User ID: 1 Punch ID: 21587 CRC32: 1118498621 DEBUG [L1759] [245ms]: PunchFactory::getImageFileName(): Punch Image File Name: /var/timetrex/storage//punch_images/1/1/11/18/49/21587.jpg Company ID: 1 User ID: 1 Punch ID: 21587 CRC32: 1118498621 DEBUG [L1719] [245ms] Array: PunchFactory::saveImage(): NOT Saving Image File Name: /var/timetrex/storage//punch_images/1/1/11/18/49/21587.jpg bool(false) DEBUG [L1671] [245ms]: Factory::CommitTransaction(): CommitTransaction(): Transaction Count: 1 Trans Off: 2 DEBUG [L0530] [245ms]: APIPunch::setPunch(): Saving PCF data... Punch Control ID: 33861 DEBUG [L0600] [248ms]: Factory::setCreatedAndUpdatedColumns(): Set created/updated columns... DEBUG [L1678] [248ms]: Factory::isValid(): Calling Validate() DEBUG [L1085] [248ms]: PunchControlFactory::Validate(): Validating... DEBUG [L0877] [249ms]: PunchControlFactory::calcTotalTime(): No Punches to calculate, or punches arent in pairs. Set total to 0 DEBUG [L0333] [253ms]: PunchControlFactory::findUserDate(): Finding DateStamp: 2015-02-25 12:00 Punch Control: 33861 User: 1 DEBUG [L1695] [255ms]: PayPeriodScheduleFactory::getShiftData(): Punch Rows: 1 UserID: 1 Date: 2015-02-25 12:00(1424880000) MaximumShiftTime: 57600 NewShiftTrigger: 14400 Filter: nearest_shift DEBUG [L1723] [255ms]: PayPeriodScheduleFactory::getShiftData(): Passed non-saved punch control object that matches, using that instead... Using ID: 33861 DEBUG [L1796] [255ms]: PayPeriodScheduleFactory::getShiftData(): Nearest Shift Determined to be: 0 Nearest Punch Diff: 0 Punch Diff: 0 Epoch: 2015-02-25 12:00 Current Punch: 2015-02-25 12:00 DEBUG [L0386] [255ms]: PunchControlFactory::findUserDate(): Found DateStamp: 1424880000 Based On: 2015-02-25 12:00 DEBUG [L1095] [256ms]: PunchControlFactory::Validate(): DateStamp: 1424880000 DEBUG [L1209] [258ms]: PunchControlFactory::Validate(): Current Punch ID: 21587 Punch Control ID: 33861 Status: 10 DEBUG [L1221] [258ms]: PunchControlFactory::Validate(): bPunch does not match any other punch pair. DEBUG [L0057] [259ms]: PunchListFactory::getPayPeriodMaximumShiftTime(): cPay Period Schedule Maximum Shift Time: 57600 DEBUG [L1258] [259ms]: PunchControlFactory::Validate(): Maximum shift time: 57600 DEBUG [L1661] [259ms]: Factory::StartTransaction(): StartTransaction(): Transaction Count: 1 Trans Off: 1 DEBUG [L1727] [259ms]: Factory::Save(): Calling preSave() DEBUG [L0877] [260ms]: PunchControlFactory::calcTotalTime(): No Punches to calculate, or punches arent in pairs. Set total to 0 DEBUG [L0333] [260ms]: PunchControlFactory::findUserDate(): Finding DateStamp: 2015-02-25 12:00 Punch Control: 33861 User: 1 DEBUG [L0386] [260ms]: PunchControlFactory::findUserDate(): Found DateStamp: 1424880000 Based On: 2015-02-25 12:00 DEBUG [L0889] [261ms]: PunchControlFactory::changePreviousPunchType(): Previous Punch to Lunch/Break... DEBUG [L0976] [261ms]: PunchControlFactory::changePreviousPunchType(): Returning false! DEBUG [L1678] [261ms]: Factory::isValid(): Calling Validate() DEBUG [L1085] [261ms]: PunchControlFactory::Validate(): Validating... DEBUG [L0877] [262ms]: PunchControlFactory::calcTotalTime(): No Punches to calculate, or punches arent in pairs. Set total to 0 DEBUG [L0333] [262ms]: PunchControlFactory::findUserDate(): Finding DateStamp: 2015-02-25 12:00 Punch Control: 33861 User: 1 DEBUG [L0386] [262ms]: PunchControlFactory::findUserDate(): Found DateStamp: 1424880000 Based On: 2015-02-25 12:00 DEBUG [L1095] [263ms]: PunchControlFactory::Validate(): DateStamp: 1424880000 DEBUG [L1209] [263ms]: PunchControlFactory::Validate(): Current Punch ID: 21587 Punch Control ID: 33861 Status: 10 DEBUG [L1221] [263ms]: PunchControlFactory::Validate(): bPunch does not match any other punch pair. DEBUG [L0057] [264ms]: PunchListFactory::getPayPeriodMaximumShiftTime(): cPay Period Schedule Maximum Shift Time: 57600 DEBUG [L1258] [264ms]: PunchControlFactory::Validate(): Maximum shift time: 57600 DEBUG [L1639] [265ms]: Factory::getInsertQuery(): Insert DEBUG [L1661] [270ms]: Factory::StartTransaction(): StartTransaction(): Transaction Count: 1 Trans Off: 2 DEBUG [L1727] [270ms]: Factory::Save(): Calling preSave() DEBUG [L1765] [270ms]: Factory::Save(): Insert ID: 248076 Table: system_log DEBUG [L1639] [270ms]: Factory::getInsertQuery(): Insert DEBUG [L1671] [273ms]: Factory::CommitTransaction(): CommitTransaction(): Transaction Count: 1 Trans Off: 3 DEBUG [L0178] [273ms]: LogDetailFactory::addLogDetail(): System Log ID: 248076 Class: PunchControlFactory DEBUG [L0428] [273ms]: LogDetailFactory::addLogDetail(): Logged detail records in: 0.00059604644775391 DEBUG [L1817] [273ms]: Factory::Save(): Calling postSave() DEBUG [L0174] [273ms]: Factory::removeCache(): Attempting to remove cache: 33861 DEBUG [L0180] [273ms]: Factory::removeCache(): Removing cache: 33861 Group Id: punch_control DEBUG [L1371] [273ms]: PunchControlFactory::calcUserDate(): Calculating User ID: 1 DateStamp: 1424880000 DEBUG [L1455] [273ms]: PunchControlFactory::calcUserDate(): Punches are not paired, not re-arranging days... DEBUG [L1460] [273ms]: PunchControlFactory::calcUserDate(): Returning FALSE DEBUG [L1466] [273ms]: PunchControlFactory::calcUserDateTotal(): Calculating User Date Total... DEBUG [L1470] [278ms]: PunchControlFactory::calcUserDateTotal(): Checking for Conflicting User Date Total Records, count: 0 DEBUG [L1503] [278ms]: PunchControlFactory::calcUserDateTotal(): No Conflicting User Date Total Records, inserting the first one. DEBUG [L1507] [278ms]: PunchControlFactory::calcUserDateTotal(): Updating UserDateTotal row ID: DEBUG [L1530] [280ms]: PunchControlFactory::calcUserDateTotal(): No IN PunchObject! DEBUG [L1532] [280ms]: PunchControlFactory::calcUserDateTotal(): Using passed PunchObject instead... DEBUG [L1543] [280ms]: PunchControlFactory::calcUserDateTotal(): No OUT PunchObject! DEBUG [L1549] [280ms]: PunchControlFactory::calcUserDateTotal(): ERROR: No PunchObject! DEBUG [L1678] [280ms]: Factory::isValid(): Calling Validate() DEBUG [L1661] [281ms]: Factory::StartTransaction(): StartTransaction(): Transaction Count: 1 Trans Off: 2 DEBUG [L1727] [281ms]: Factory::Save(): Calling preSave() DEBUG [L1678] [282ms]: Factory::isValid(): Calling Validate() DEBUG [L1765] [283ms]: Factory::Save(): Insert ID: 177424 Table: user_date_total DEBUG [L1639] [283ms]: Factory::getInsertQuery(): Insert DEBUG [L0057] [289ms]: DBError::__construct(): Begin Exception... DEBUG [L0058] [289ms] Array: DBError::__construct(): BackTrace: string(425) "#0.Debug::backTrace() #1.DBError->__construct(Object(ADODB_Exception)) #2.Factory->Save() #3.PunchControlFactory->calcUserDateTotal() #4.PunchControlFactory->postSave(Array(0)) #5.Factory->Save(1, 1) #6.APIPunch->setPunch(Array(1)) #7.call_user_func_array(Array(2), Array(1)) #8.authenticatedInvokeService(APIPunch, setPunch, Array(1), 69ace86e-17d3-55e8-6455-943a0759518f, Object(Authentication), Object(APIAuthentication)) " DEBUG [L0065] [289ms]: DBError::__construct(): mysqli error: [1062: Duplicate entry '177424' for key 'PRIMARY'] in adodb_throw(INSERT INTO user_date_total ( ID, USER_ID, PAY_PERIOD_ID, DATE_STAMP, OBJECT_TYPE_ID, PAY_CODE_ID, PUNCH_CONTROL_ID, BRA DEBUG [L0065] [289ms]: DBError::__construct(): NCH_ID, DEPARTMENT_ID, JOB_ID, JOB_ITEM_ID, QUANTITY, BAD_QUANTITY, START_TYPE_ID, START_TIME_STAMP, TOTAL_TIME, ACTUAL_TOTAL_TIME, TOTAL_TIME_AMOUNT, TOTAL_TIME_AMOUNT_WITH_BURDEN, CREATED_DATE, CREA DEBUG [L0065] [289ms]: DBError::__construct(): TED_BY, UPDATED_DATE, UPDATED_BY ) VALUES ( 177424, 1, 142, '2015-02-25', 10, 0, 33861, 0, 0, 0, 0, 0, 0, 10, '2015-02-25 12:00:00', 0, 0, 0, 0, 1424888950, 1, 1424888950, 1 ), ) DEBUG [L0065] [289ms]: DBError::__construct(): DEBUG [L0073] [289ms]: DBError::__construct(): End Exception... ============================================================================ {"api_retval":false,"api_details":{"code":"EXCEPTION","description":"TimeTrex-Debug is unable to connect to its database, please make sure that the database service on your own local TimeTrex-Debug server has been started and is running. If you are unsure, try rebooting your server.","record_details":{"total":0,"valid":0,"invalid":0},"user_generic_status_batch_id":false,"request":false,"pager":false,"details":false}}
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Re: TimeTrex is unable to connect to its database, please ma

Post by shaunw »

Looks like your MySQL sequences are out of sync, try setting installed_enabled=TRUE in your timetrex.ini.php then running the web installer again, that should attempt to fix the issue for you.
gregory
Posts: 102
Joined: Fri Oct 28, 2011 3:39 pm

Re: TimeTrex is unable to connect to its database, please ma

Post by gregory »

Did not know could install an already installed version, but it worked.

Thank you!
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Re: TimeTrex is unable to connect to its database, please ma

Post by shaunw »

Its smart enough to determine that and attempt a repair instead of an actual new installation of course.
Post Reply