Bad value on output port 'efile'

Error

I want to migrate the database of ejabberd from Mnesia to ODBC, so I try to export using ejd2odbc or export2odbc. All tables are correctly exported except 'roster'. The file is generated, but it's emtpy. Also, I get this error message on ejabberd log file several times during the export process:

=ERROR REPORT==== 2007-05-12 12:45:17 ===
Bad value on output port 'efile'

Explanation

The problem you face is probably that some items on the 'roster' table have an undesired value for the attribute 'askmessage'. The export process on ejabberd 1.1.3 and older versions is not capable of handling those items, and the whole export roster export process fails.

Solution

Versions of ejabberd newer than 1.1.3 include this fix. You can update to newer ejabberd, or apply this patch, or simply copy the ejd2odbc.beam patched binary file to your ejabberd directory and restart ejabberd.

--- src/ejd2odbc.erl    (revisión: 716)
+++ src/ejd2odbc.erl    (revisión: 769)
@@ -315,13 +315,21 @@
               in          -> "I";
               none        -> "N"
           end,
+    SAskMessage =
+       case catch ejabberd_odbc:escape(
+                    binary_to_list(list_to_binary([AskMessage]))) of
+           {'EXIT', _Reason} ->
+               [];
+           SAM ->
+               SAM
+       end,
     ["("
      "'", Username, "',"
      "'", SJID, "',"
      "'", Nick, "',"
      "'", SSubscription, "',"
      "'", SAsk, "',"
-     "'", AskMessage, "',"
+     "'", SAskMessage, "',"
      "'N', '', 'item')"].
Syndicate content