OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



DB Error: Help!

Are you responsible for making OJS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
What to do if you have a technical problem with OJS:

1. Search the forum. You can do this from the Advanced Search Page or from our Google Custom Search, which will search the entire PKP site. If you are encountering an error, we especially recommend searching the forum for said error.

2. Check the FAQ to see if your question or error has already been resolved.

3. Post a question, but please, only after trying the above two solutions. If it's a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a development question, try the OJS Development subforum.

DB Error: Help!

Postby ata_gp » Fri Mar 23, 2007 4:06 am

Hi,

Today has appear the next error loading my journal running on OJS.

" DB Error: Unknown column 'session_id' in 'where clause' "

Please, anybody could help me? I got no idea what's the bug.

Thanks in advance

http://ata.t100e.com/ojs
ata_gp
 
Posts: 28
Joined: Wed Feb 07, 2007 4:34 pm
Location: Madrid (Spain)

Postby asmecher » Fri Mar 23, 2007 9:46 am

Hi ata_gp,

It looks like something has modified your database schema; the session_id column is missing. If this is the only problem, you can correct it with the following MySQL queries:
Code: Select all
DELETE FROM sessions;
ALTER TABLE sessions ADD session_id INT UNSIGNED NOT NULL AUTO_INCREMENT;
This sort of thing, however, should NEVER happen by accident. Do you have any idea how this came up?

Regards,
Alec Smecher
Open Journal Systems Team
---
Don't miss the First International PKP Scholarly Publishing Conference
July 11 - 13, 2007, Vancouver, BC, Canada
http://ocs.sfu.ca/pkp2007/
asmecher
 
Posts: 8869
Joined: Wed Aug 10, 2005 12:56 pm

Postby ata_gp » Fri Mar 23, 2007 12:07 pm

You're right.. I installed OsCommerce into the same data base.

I've tried to make the queries to MySQL but it's quite dificult for my. Is there any easiest solution for this?

Thanks a lot,
Ata
ata_gp
 
Posts: 28
Joined: Wed Feb 07, 2007 4:34 pm
Location: Madrid (Spain)

Postby asmecher » Fri Mar 23, 2007 5:38 pm

Hi ata_gp,

If the sessions table is the only one that got overwritten, you're lucky -- there are probably only two tables in the entire database that you can lose without losing valuable data. Are you sure there aren't other tables with the same problem, particularly those with common names like "users"? If the users table has been altered, you'd be best off going to a backup.

Otherwise, you can use the the dbXMLtoSQL.php tool to re-generate the table SQL. Run:
Code: Select all
php tools/dbXMLtoSQL.php -schema print dbscripts/xml/ojs_schema.xml
Find the CREATE TABLE statement for the sessions table and use that to create the table.

I'm not sure what your question is in the previous post... could you rephrase? If you're not sure how to run queries, see if your host offers phpmysqladmin in the hosting package. That's probably the easiest way to run queries.

Regards,
Alec Smecher
Open Journal Systems Team
---
Don't miss the First International PKP Scholarly Publishing Conference
July 11 - 13, 2007, Vancouver, BC, Canada
http://ocs.sfu.ca/pkp2007/
asmecher
 
Posts: 8869
Joined: Wed Aug 10, 2005 12:56 pm

Postby ata_gp » Sat Mar 24, 2007 5:35 am

I'm sorry Alec.

I rephrase my last question: "I've tried to make the queries to MySQL but it's quite difficult for me. Is there any easy solution for this?"

Yes, my host offers phpMyAdmin in the hosting packge but it's a really mess 'cause it's my first experience with this trouble.

On the other hand, I've tried to regenate the table running php tools, but it doesn't work, maybe because I use the mozilla browser for doing it.
ata_gp
 
Posts: 28
Joined: Wed Feb 07, 2007 4:34 pm
Location: Madrid (Spain)

Postby asmecher » Mon Mar 26, 2007 9:09 am

Hi ata_gp,

PhpMyAdmin should have a "SQL" pop-up where you can enter queries one-at-a-time for execution.

You won't be able to run the dbXMLtoSQL.php tool via the web browser; it's intended for command-line use only. Here is the script to generate a current version of the Sessions table:
Code: Select all
DROP TABLE sessions;

CREATE TABLE sessions (
session_id               VARCHAR(32) NOT NULL,
user_id                  BIGINT,
ip_address               VARCHAR(15) NOT NULL,
user_agent               VARCHAR(255),
created                  BIGINT NOT NULL DEFAULT 0,
last_used                BIGINT NOT NULL DEFAULT 0,
remember                 TINYINT NOT NULL DEFAULT 0,
data                     TEXT,
                 PRIMARY KEY (session_id)
);

ALTER TABLE sessions ADD  INDEX sessions_user_id  (user_id);
Regards,
Alec Smecher
Open Journal Systems Team
---
Don't miss the First International PKP Scholarly Publishing Conference
July 11 - 13, 2007, Vancouver, BC, Canada
http://ocs.sfu.ca/pkp2007/
asmecher
 
Posts: 8869
Joined: Wed Aug 10, 2005 12:56 pm

Thanks

Postby ata_gp » Tue Mar 27, 2007 6:29 am

Fine! I've got the table working again. A lot of thanks
Rafa
ata_gp
 
Posts: 28
Joined: Wed Feb 07, 2007 4:34 pm
Location: Madrid (Spain)


Return to OJS Technical Support

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest