Problem DB Error: Data too long for column

Hello
i Have a PROBLEME with registring a new journal index.php/index/admin/createJournal
when i insert the journal name and description and path i get this error in a blank page

DB Error: Data too long for column 'abbrev' at row 1

and when i check to see the journla i found it but without a name or a description
i have translated my journal to arabic and its working perfect but this probleme i couldn’t solve it

I’m just guessing, but the most likely explanation I can come up with for this would be that an entry for context_abbrev in one of the Arabic reading tools files is longer than 32 characters:

What version of OJS are you using? Have you made any changes to these files?

1 Like

thnx for the replay
my version is 2.4.5.0
i don’tt think i changed this files
and the problem shows up on the first step of making a new journal

when i fill the journal title and description and path and hit save this error shows up

The only actual database column abbrev that I’m aware of is rt_contexts.abbrev. The rt_contexts will be populated at journal creation: rt_contexts.version_idrt_versions.version_id, rt_versions.journal_idjournals.journal_id

In the rt XML files, the element context_abbrev will be inserted into rt_contexts.abbrev. If the default value exceeds the rt_context.abbrev field length (32 characters), I could imagine this error occurring. I wasn’t able to reproduce it myself.

1 Like

I’ve just noticed that the rt/ar_IQ files don’t exist in 2.4.5. Can you make a test install with 2.4.7 and see if the problem persists?

1 Like

i tried to insert a smal word for the title ‘‘4 characters’’ and the same problem

This wouldn’t be related to any of the fields you see on the form.

When you submit the new Journal, a lot of data is populated by default behind the scenes. For example, default sections, and the Reading Tools data.

I suspect that the population of the default Reading Tools data for the Arabic locale may be the problem, but I’m not sure. Trying this same thing in 2.4.7 would give another data point.

1 Like

can i replace the rt file of my version with the new version

Sure. You can try copying the folder /rt/ar_IQ/ from 2.4.7 into 2.4.5.

Another option to get more information would be to turn on show_stacktrace in config.inc.php. Copy and paste the stack trace from the error log here.

1 Like
DB Error: Data too long for column 'abbrev' at row 1

Stack Trace:

File: /var/www/html/ar/classes/rt/ojs/RTDAO.inc.php line 369
Function: DAO->update("INSERT INTO rt_contexts (version_id, title, abbrev, descripti...", Array(9))

File: /var/www/html/ar/classes/rt/ojs/RTDAO.inc.php line 184
Function: RTDAO->insertContext(Object(RTContext))

File: /var/www/html/ar/classes/rt/ojs/JournalRTAdmin.inc.php line 56
Function: RTDAO->insertVersion("23", Object(RTVersion))

File: /var/www/html/ar/classes/admin/form/JournalSiteSettingsForm.inc.php line 166
Function: JournalRTAdmin->restoreVersions(False)

File: /var/www/html/ar/pages/admin/AdminJournalHandler.inc.php line 98
Function: JournalSiteSettingsForm->execute()

File: (unknown) line (unknown)
Function: AdminJournalHandler->updateJournal(Array(0), Object(Request))

File: /var/www/html/ar/lib/pkp/classes/core/PKPRouter.inc.php line 362
Function: call_user_func(Array(2), Array(0), Object(Request))

File: /var/www/html/ar/lib/pkp/classes/core/PKPPageRouter.inc.php line 220
Function: PKPRouter->_authorizeInitializeAndCallRequest(Array(2), Object(Request), Array(0), False)

File: /var/www/html/ar/lib/pkp/classes/core/Dispatcher.inc.php line 134
Function: PKPPageRouter->route(Object(Request))

File: /var/www/html/ar/lib/pkp/classes/core/PKPApplication.inc.php line 178
Function: Dispatcher->dispatch(Object(Request))

File: /var/www/html/ar/index.php line 64
Function: PKPApplication->execute()

This confirms that it is the Reading Tools context which is raising the database error. I’m still not clear what data is actually causing the error.

One big difference between your install and most others would be that it looks like you’ve only enabled Arabic in the Site. Another thing to try would be to enable English and Arabic at the Site level, and see if the error persists.

1 Like

okey
when i do it in english it works fine with an arabic title
but with arabic as default language it dosnt work

it works 

so what could be the problem

@asmecher or @mtub might have more experience in what works or doesn’t work in disabling English as an available locale.

1 Like

okey thank you very much for your time sir

i will wait for @asmecher or @mtub to resolve my issue

thanks again @ctgraham

Hi @hell_boy,

I haven’t been able to duplicate that problem locally. Can you report back what your settings are for connection_charset and database_charset in the config.inc.php configuration file?

To get more information, try turning on the debug option in config.inc.php just before pressing the button to create a new journal. That will dump all SQL queries out to the browser; the last one listed before the error message will be the one that causes the problem. That’ll help me debug if you can post it.

Regards,
Alec Smecher
Public Knowledge Project Team

this is the last lines after turning on the debug

(mysql): INSERT INTO rt_contexts (version_id, title, abbrev, description, cited_by, author_terms, geo_terms, define_terms, seq) VALUES (107, ‘البحث عن المصطلحات’, ‘البحث عن المصطلحات’, ‘أنقر نقراً مزدوجاً على أي كلمة في النص وستظهر في صندوق “تعريف المصطلحات”. بإمكانك أيضاً طباعة الكلمات أو لصقها فيه. ثم استعمل وظيفة البحث للعثور على تعريف للكلمة. تم اختيار هذه الموارد كونها ذات صلة ومجانية، إذ تتيح الوصول لكل أو بعض محتواها مجاناً.’, 0, 0, 0, 1, 1)
1406: Data too long for column ‘abbrev’ at row 1
ADOConnection._Execute(INSERT INTO rt_contexts
(version_id, title, abbrev, description, cited_by, author_terms, geo_terms, define_terms, seq)
VAL…) % line 845, file: adodb.inc.php
ADOConnection.Execute(INSERT INTO rt_contexts
(version_id, title, abbrev, description, cited_by, author_terms, geo_terms, define_terms, seq)
VAL…, Array[9]) % line 226, file: DAO.inc.php
DAO.update(INSERT INTO rt_contexts
(version_id, title, abbrev, description, cited_by, author_terms, geo_terms, define_terms, seq)
VAL…, Array[9]) % line 369, file: RTDAO.inc.php
RTDAO.insertContext(Object:RTContext) % line 184, file: RTDAO.inc.php
RTDAO.insertVersion(17, Object:RTVersion) % line 56, file: JournalRTAdmin.inc.php
DB Error: Data too long for column ‘abbrev’ at row 1

(mysql): UPDATE sessions SET user_id = 1, ip_address = ‘41.105.184.159’, user_agent = ‘Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.99 Safari/537.36’, created = 1447608548, last_used = 1447616109, remember = 0, data = ‘username|s:4:“zaiz”;userId|s:1:“1”;’, domain = ‘revues.univ-eloued.dz’ WHERE session_id = ‘if7tcn5hvo03ndch3i14eoq153’

Hi @hell_boy,

And what about the configuration items I asked about above?

Regards,
Alec Smecher
Public Knowledge Project Team

connection_charset and database_charset are off

Hi @hell_boy,

The character set configuration is the problem. The content being inserted into the database is UTF-8 encoded, but your database configuration hasn’t been set to use UTF-8. That means that according to MySQL the data will appear longer than it actually is. If you’re working with a fresh installation, I’d suggest starting again but setting up your database connection to use UTF-8.

Regards,
Alec Smecher
Public Knowledge Project Team

okey its frech installing but how to change the encode to UTF-8