Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

Install problem - Commands out of sync

Quote Reply
Install problem - Commands out of sync
Trying to install Links SQL I run into a weird problem that I'm wondering if someone else might have run into / fixed.... I'm using 1.1b3 Everything went fine until I get to setup.cgi running from either telnet (ssh) or the web. It starts out fine and creates the first table - Build_update, but every other table after that fails to get created with the error message: failed (DBSQL (16194): Fatal Error: Unable to execute query: Reason: Commands out of sync; You can't run this command now at ./setup.cgi line 290 (or line 292). A review of the mysql list pretty much says that it has something to do with fetching the result of the query before a new one is issued... It also appears that all the .def files do get created, although none of the tables do. Anyone have any ideas on what might be wrong.

Jerry
Quote Reply
Re: Install problem - Commands out of sync In reply to
This is a new one for me. What happens if you try and cut and paste the CREATE TABLE sql command from the SQL.mysql (for lets say the Links table) into the mysql monitor? Does it create it ok?

Cheers,

Alex
Quote Reply
Re: Install problem - Commands out of sync In reply to
FWIW.... I've run it by telnet and http and in about 30 different set ups and restarts never hit that one.

Are you on a virtual host or using a mysql server on a different machine? If so, maybe there is some weird sort of caching secondary to load balancing. By not going through the http daemon you'd be hitting a sync problem.
Quote Reply
Re: Install problem - Commands out of sync In reply to
If I cut and paste the create table commands one at a time, the tables do get created and appear when I do 'show tables' from the mysql command prompt. Now, I went to the setup.cgi program and Recreate .def files only, I get

Creating def file for Build_Update ... ok
Creating def file for Category ... failed (table doesn't exist?)
...
the rest of the def files also fail, so it's not seeing the tables that I cut and pasted into the mysql command prompt.

If I delete the tables, however, the Build_Update table does not get removed.

The mysql server and web server are on the same machine. It's not a virtual host, it's my own box. There are only about 20 or 30 sites on the box, max.

From what I see on the mysql list archive on listquest, it seems that mysql needs to fetch the results before doing the next query, but I'm not sure exactly what that means or how to fix it.... For example, this post refers to the same error message I appear to be getting - in case this starts pointing someone in the right direction.

http://www.listquest.com/lq/view.cgi?ln=mysql&mid=11709&sp=&q=Commands+out+of+sync&b=1&s=1&o=0&ci=c061704845

I know mysql runs fine, I have other databases running on the server that I work with every day, on a regular basis. FWIW, I'm running FreeBSD 2.2.8 and mysql 3.22.14b-gamma. The database is called mylinks, in case the name of the db matters, and I'm running the setup.cgi as root, using my root login to mysql that has full privileges.

As I mentioned, I'm trying the 1.1b3 beta, I have not installed any 1.0x version at all. I really haven't made many changes to any of the files, except to set up as appropriate for my machine.

Any ideas or other info I can get to help figure out the problem?

Jerry
Quote Reply
Re: Install problem - Commands out of sync In reply to
Are you accessing as a user or as root?

This sounds like it may be a problem with permissions more than anything else --

When I didn't have tables deleted, it was because they were either pointing to the wrong database, or the permissions were wrong.

If you can run PHP3 scripts, try the myAdmin program. It really makes accessing the mysql daemon easier. It converts the character interface into an HTML/cgi interface, and helps make maintennance easier. You can do almost everything with it in point/click fashion that you can do at the command prompt. I don't remember the last time I had to resort to the mysql> prompt -- had to be at least 2 months ago.



Quote Reply
Re: Install problem - Commands out of sync In reply to
I'm access mysql as from my root account on both the server and mysql monitor. I don't think it's a permissions problem because the first table always gets built. It's the second and all other tables. Also, if I put them all in by hand, and then go to setup.cgi, I can delete them all with the delete command. I don't have php set up right now, so I think I'll give this problem a try over on the mysql list. Thanks for trying though.

Jerry
Quote Reply
Re: Install problem - Commands out of sync In reply to
Hello!

Since you are looking for other info on figuring how to solve your problem, I could suggest you to go for phpMyAdmin utility from www.phpwizard.net.

Installing this utility, you may notice that it is very very practical for problem solving or trouble shooting in such cases.

Further, if you have installed one table that from this utility you can duplicate the same table with its structure (Or even with data) to see what it does! This utility gives you an overview of all the databases + all the tables within the database. So it may be also very handy tool in your case, as a webmaster + administrator.

I have had several confusions about the defs. The editor.cgi starts only loading the defs and that may not have anything to do with the actual tables. One assumes ofcourse that the user will only use the editor.cgi and therefore the defs will always be the last situation in relation to the tables. So later if you do the fine tweaking of the tables through monitors (Telnet or Links SQL) then they remain older than the actual tables and while loading the editor.cgi are not in realtime. Hence resync (Good thing, or intellegint, about this area is thats its one way updating only Smile).

It is therefore I have used many many times in my such trouble shooting phpmyAdmin to actually find out in real time what is inside the tables, overview and their respective properties rather than defs.

However it may not help to solve your problem but could be a handy utility.

[This message has been edited by rajani (edited November 30, 1999).]
Quote Reply
Re: Install problem - Commands out of sync In reply to
What OS are you using?

I think there are OS specfic problems as well. The MySQL lists are probably the best place to go with that .... You might have to pass it a parameter or recompile it with some extra or changed options.

Quote Reply
Re: Install problem - Commands out of sync In reply to
If you can email me telnet access I'll be happy to take a look.

Cheers,

Alex
Quote Reply
Re: Install problem - Commands out of sync In reply to
I'm running FreeBSD 2.2.8, but I don't think it's OS specific, although I could be wrong. I haven't heard back from the mysql list yet, but I did find this page
http://www.tcx.se/Manual_chapter/manual_Problems.html#IDX684
on the mysql site which says:
"If you get Commands out of sync; You can't run this command now in your client code, you are calling client functions in the wrong order!

This can happen, for example, if you are using mysql_use_result() and try to execute a new query before you have called mysql_free_result(). It can also happen if you try to execute two queries that return data without a mysql_use_result() or mysql_store_result() in between."

Anyone have any idea what that means? From looking aroun though, it almost seems to be part of the C API, which is very weird....

I just noticed in playing with setup.cgi - when I hand create all the tables and end up with .def files (I assume from trying to delete them at some point) and then go to setup.cgi I get a message that says

Please switch to the new connect method documenteded in DBI 0.84:
$dbh = DBI->connect($dsn).
We now emulate the call
$drh->connect('mylinks'),
but this exception will go away soon.
at /usr/local/lib/perl5/site_perl/DBI.pm line 352
Connecting ... ok!

According to the setup though, I'm running
DBI.pm ... version 0.93 ok!

Alex, telnet access will be a problem right now... which is going to make debugging this thing even worse... Let me dump everything on 1.1b3 and see if I can get the 1.0 version running.

Jerry
Quote Reply
Re: Install problem - Commands out of sync In reply to
Okay, here's a really stupid question. Does the database have to be called 'Links'?

The reason I ask is that since I hand created the tables and the .def files seem to be there, I started trying to mess around with the admin.cgi program. When I click on View categories or Add categories, I get

Software error:

DBSQL (22760): Fatal Error: Unable to connect to the SQL server. Reason: Unknown database 'Links' at Links/Admin_HTML.pm line 396

Please send mail to this site's webmaster for help.

Has anyone set this up using a different database name? I'm going to try reinstalling from scratch later on tonite and use Links as the database name instead of mylinks and see if that solves the problem.

Jerry
Quote Reply
Re: Install problem - Commands out of sync In reply to
Hi Jerry,

Are you able to update your modules? 0.93 is quite old, and your DBD::mysql module may be even older. Try getting the latest DBI and DBD::mysql installed.

Cheers,

Alex
Quote Reply
Re: Install problem - Commands out of sync In reply to
Hello!

There are also other Admin clients giving web interfaces without using php interface. You may find it from MySQL.com/Contrib or somewhere there. You ofcourse DONOT obviously needs a webinterface! But its practical is you are not a fan
of telnet, like me (Thanks to Alex to bring out more and more web-interfaces).

Sounds like a hot discussion pointing to the manner how the query is done! Very interesting.

Links SQL "IS NOT DATABASE name specific"! However it has restriction on the use of table names and the column names + the main KEY of the table. What you have, I think, could be a problem in the defs top lines.

Code:
$db_name = 'Your database name';
$db_host = 'Your Server name of MySQL';
$db_driver = 'mysql';
$db_user = 'Your log-in name';
$db_pass = 'A full access password of yours'; with read and write + full access password
$db_key = 'ID'; Let this remain and has to be the column in the table. check here!
$db_table = 'Links'; Name of the table and it has to be the same! # check here!
$db_track = '1';


So if the name of the database did not match the value inserted above then it obviously cannot connect the server. Therefore it will generate a database connection error $e1 from DBSQL.pm as a reason.

From my Fatals in DBSQL.pm as follows ---

'CANTCONNECT' => "Unable to connect to the SQL server. Reason: $e1",

DBSQL.pm is a really nasty one that has done a lot of BARKING at me if things were somewherenot in order. It has also given me a lot of nightmares. Really wild. Only because its a very very rigid solid and strong programming. In other words, its a wealth full of extra-ordinary way of handling many functions and routines. Its the logic and the manner how a concept of the program is concieved to function.

Therefore, After creating the tables, you may be able to load the Admin_HTML.pm, but when it trys to connect for any function to perform through the following
Code:
$DATABASE = $in->param('db');
$OBJECT = $DATABASE;

<a href="$SCRIPT_URL?db=Links&do=html_view_search">View</a><br>
Further you will find every where the above in this module Admin_HTML.pm. db=Links means the table. Unfortunately db should have been used for database rather than table, but never mind. So the db variable is passed to the module and it cannot find the table Links.

It will check first from the defs what, how and method to work on a MySQL database. If the above defs lines are not correct it will obviously SHOUT, that it cannot! Alex should have defined connection errors resulting out of tables or database connections differently, but I do not know Wink.

Check the first lines of defs as mentioned above. I however could be completely wrong.
Quote Reply
Re: Install problem - Commands out of sync In reply to
Maybe I'm missing something, but let's go back a bit, starting with a fresh install - using the new 1.1 - executing setup.cgi gives me this:

Connecting to the database.
Please switch to the new connect method documenteded in DBI 0.84:
$dbh = DBI->connect($dsn).
We now emulate the call
$drh->connect('Links:localhost'),
but this exception will go away soon.
at /usr/local/lib/perl5/site_perl/DBI.pm line 352
Connecting ... ok!

(I'm not exactly sure what this error message means since I'm using DBI 0.93)

Choice: C
Creating tables ... (, , )
Creating table Build_Update ... ok
Loading def file from SQL ... ok!
Saving def file ... ok!
Creating table Category ... failed (DBSQL (7793): Fatal Error: Unable to execute query:
(SQL Command from SQL.mysql goes in here)
. Reason: Commands out of sync; You can't run this command now at ./setup.cgi line 293

Now I know I'm connected to the database. I have to be or otherwise the first table would never get built. I'm not sure that the Build_Update.def is being properly created, because nothing is shown in $db_def or any of the other $db_ fields. Here is my Build_Update.def

package Links: BSQL::Build_Update;

$db_name = 'Links';
$db_host = 'localhost';
$db_driver = 'mysql';
$db_user = 'user';
$db_pass = 'pass';
$db_key = '';
$db_table = 'Build_Update';
$db_track = '';
$attach_dir = '';

%db_def = (

);

%db_select_fields = (

);
%db_checkbox_fields = (

);
%db_radio_fields = (

);

1;

The rest of the def files all have Build_Upate in the $db_table, but I'm assuming that is because of the errors in loadinq the SQL commands - so I have no comfort level in relying on them.

When I do a describe Build_Update from the mysql monitor I get this:

+--------+----------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------+----------------------+------+-----+---------+-------+
| LinkID | int(10) unsigned | | PRI | 0 | |
| Hits | smallint(5) unsigned | | | 0 | |
| Votes | smallint(5) unsigned | | | 0 | |
| Rating | smallint(5) unsigned | | | 0 | |
+--------+----------------------+------+-----+---------+-------+

I'm assuming this is correct...???

I can cut and paste all the individual create table statements, so the problem doesn't appear to be in there.

I really think the problem is somewhere in the foreach loop that creates the tables and def files and how all the sql commands are getting issued. The individual pieces all seem to work, it's just that the program as a whole isn't. I just can't tell if it's a problem with creating the first .def file or if it's a problem with creating the second table. I'm guessing that by looking at the Build_Update.def file, that it is not correct and that's where the problem starts...

Jerry
Quote Reply
Re: Install problem - Commands out of sync In reply to
Well, 1.02 didn't work, the 1.1 that just came out didn't work, changing the database name to Links didn't work. On 1.02, setup.cgi just died after the first table failure, instead of continuing on, unlike 1.1x which went thru them all.
Quote Reply
Re: Install problem - Commands out of sync In reply to
Well, that did it. All the tables were created just fine now and the .def files look normal. I had to update DBI and DBD (which also required the DataDumper module). Took about 10 minutes and I'm a happy camper. From what I can tell so far, it didn't break any of my other databases either. Thanks to everyone for all your help, now I'm off to play. Smile

Jerry