DMXzone Database Connector PHP Support Product Page

Solved

DATABASE SOURCE & TEST NOT WORKING

Reported 05 Oct 2014 16:11:08
2
have this problem
05 Oct 2014 16:11:08 Bill Antalek posted:
DATABASE SOURCE NOT WORKING

My info:
Mac OSX Mavericks, MAMP server
PHP 5.4.4
MySql
• Server: Localhost via UNIX socket
• Server type: MySQL
• Server version: 5.5.25 - Source distribution
• Protocol version: 10
• User: root@localhost
• Server charset: UTF-8 Unicode (utf8)

Steps:
1) Create db connection OK
2) Create db source. OK to Database Source Testing. Click “Run Test” and this error:
ERROR 1:
Warning: require_once(/Applications/MAMP/htdocs/dmxtest.com/dmxDatabaseSources/../ScriptLibrary/dmxDatabaseConnector/sqlBuilder.php): failed to open stream: No such file or directory in /Applications/MAMP/htdocs/dmxtest.com/dmxDatabaseSources/dsCategories.php on line 4

Fatal error: require_once(): Failed opening required '/Applications/MAMP/htdocs/dmxtest.com/dmxDatabaseSources/../ScriptLibrary/dmxDatabaseConnector/sqlBuilder.php' (include_path='.:/Applications/MAMP/htdocs/ZendFramework/library') in /Applications/MAMP/htdocs/dmxtest.com/dmxDatabaseSources/dsCategories.php on line 4

Workaround 1:
require_once($base.'../ScriptLibrary/dmxDatabaseConnector/sqlBuilder.php');
require_once($base.'../ScriptLibrary/dmxDatabaseConnector/adapters/mysql/sqlBuilder.php');
The 2 lines above are in the datasource file. The second path has not been created but wizard keeps trying to update it. I manually copied sqlBuilder.php to the second folder, now I get errors that functions are redeclared.
Workaround 2:
Empty all code from first sqlBuilder.php and upload.

ERROR 2:
Simple datasource created, dsCategories. Should be equivalent to “SELECT * FROM categories”
In dsCategories.php:
$cfg = <<<JSON
{"type": "select", "table": "categories", "columns": [{"table": "categories", "column": "*", "alias": "", "sortable": false}], "wheres": [], "orders": [], "joins": []}
JSON;

In Database Source Testing wizard. Click “Run Test” or “View In Browser” generates the following error code:

{"code":"42000","message":"SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\"categories\"' at line 1","file":"\/Applications\/MAMP\/htdocs\/dmxtest.com\/ScriptLibrary\/dmxDatabaseConnector\/adapters\/mysql\/sqlBuilder.php","line":801,"trace":[{"file":"\/Applications\/MAMP\/htdocs\/dmxtest.com\/ScriptLibrary\/dmxDatabaseConnector\/adapters\/mysql\/sqlBuilder.php","line":801,"function":"execute","class":"PDOStatement","type":"->","args":[]},{"file":"\/Applications\/MAMP\/htdocs\/dmxtest.com\/ScriptLibrary\/dmxDatabaseConnector\/adapters\/mysql\/sqlBuilder.php","line":772,"function":"executeSelect","class":"SqlConnection","type":"->","args":[{"type":"select","table":"categories","joins":[],"values":[],"wheres":[],"orders":[],"columns":[{"table":"categories","column":"*","alias":"","sortable":false}],"params":[],"sortables":[],"offset":0,"limit":25,"meta":{"allTables":["categories","submissions"],"allViews":[],"tables":{"categories":{"columns":{"catId":{"type":"int","primary":true},"name":{"type":"varchar","size":15,"nullable":true}}}}},"adapter":{"typesMap":null,"LikeFormat":{"starts with":"%s LIKE (%s || '%%') ESCAPE '!'","not starts with":"%s NOT LIKE (%s || '%%') ESCAPE '!'","ends with":"%s LIKE ('%%' || %s) ESCAPE '!'","not ends with":"%s NOT LIKE ('%%' || %s) ESCAPE '!'","contains":"%s LIKE ('%%' || %s || '%%') ESCAPE '!'","not contains":"%s NOT LIKE ('%%' || %s || '%%') ESCAPE '!'"}}}]},{"file":"\/Applications\/MAMP\/htdocs\/dmxtest.com\/dmxDatabaseSources\/dsCategories.php","line":12,"function":"execute","class":"SqlConnection","type":"->","args":[{"type":"select","table":"categories","joins":[],"values":[],"wheres":[],"orders":[],"columns":[{"table":"categories","column":"*","alias":"","sortable":false}],"params":[],"sortables":[],"offset":0,"limit":25,"meta":{"allTables":["categories","submissions"],"allViews":[],"tables":{"categories":{"columns":{"catId":{"type":"int","primary":true},"name":{"type":"varchar","size":15,"nullable":true}}}}},"adapter":{"typesMap":null,"LikeFormat":{"starts with":"%s LIKE (%s || '%%') ESCAPE '!'","not starts with":"%s NOT LIKE (%s || '%%') ESCAPE '!'","ends with":"%s LIKE ('%%' || %s) ESCAPE '!'","not ends with":"%s NOT LIKE ('%%' || %s) ESCAPE '!'","contains":"%s LIKE ('%%' || %s || '%%') ESCAPE '!'","not contains":"%s NOT LIKE ('%%' || %s || '%%') ESCAPE '!'"}}},true]}],"warnings":[{"code":2,"message":"Cannot modify header information - headers already sent by (output started at \/Applications\/MAMP\/htdocs\/dmxtest.com\/dmxConnections\/dbConnLocal.php:4)","file":"\/Applications\/MAMP\/htdocs\/dmxtest.com\/ScriptLibrary\/dmxDatabaseConnector\/adapters\/mysql\/sqlBuilder.php","line":31,"trace":null},{"code":2,"message":"Cannot modify header information - headers already sent by (output started at \/Applications\/MAMP\/htdocs\/dmxtest.com\/dmxConnections\/dbConnLocal.php:4)","file":"\/Applications\/MAMP\/htdocs\/dmxtest.com\/ScriptLibrary\/dmxDatabaseConnector\/adapters\/mysql\/sqlBuilder.php","line":32,"trace":null}]}

Replies

Replied 06 Oct 2014 08:35:00
06 Oct 2014 08:35:00 Teodor Kuduschiev replied:
Hello William,
Could you please check how is your site setup in DW - links relative to site root or links relative to document? Also - please send me the following file to : dmxDatabaseSources/dsCategories.php
Replied 06 Oct 2014 15:51:56
06 Oct 2014 15:51:56 Bill Antalek replied:
I found the workaround. Dreamweaver CC 2014, Mac OSX Mavericks

Folder #1 /ScriptLibrary/dmxDatabaseConnector/sqlBuilder.php
Folder #2 /ScriptLibrary/dmxDatabaseConnector/adapters/mysql/sqlBuilder.php

Apparently sqlBuilder.php in folder #1 and #2 are different. I manually created folder #2 and copied the folder#1 file to folder #2 thinking they were the same. This did not work because they are different.

Workaround:
First, manually create folder #2
Then run the dmx wizard.

Your problem is that your wizard creates folder & file #1 and does not create folder #2, hence the folder#2 file is not created.

This was also a problem with the animation plug-in. I first had to manually create the folder for it's files.
Replied 07 Oct 2014 07:44:10
07 Oct 2014 07:44:10 Teodor Kuduschiev replied:
Hi William,
You cannot copy and paste files into different folders as they are not the same. If Dreamweaver is not creating those folders for you there is either some create/write permissions issue on your machine, or your Dreamweaver configuration is corrupted.
Replied 24 Apr 2015 22:36:57
24 Apr 2015 22:36:57 Justin Mitchell replied:
Just as a note, I had the same problem when trying to use the mssql adapter (no problem using mysql). I had to manually create the /adapters/mssql folder before the dmx script was able to write the second sqlBuilder.php. I verified file permissions in windows before doing so, just to see if it was a permissions issue. Permissions were the same below as above.

Could be Dreamweaver config corrupted. I've had to wipe it a few times in the past to fix issues.

Anyway, thanks for posting your solution Bill.

Reply to this topic