chemaxon.formats.MolFormatException: Cannot recognize format

User 715e498bfb

31-05-2010 07:06:25

Hi, All


Today my customer to edit a compound and to save it, but it throws a exception as following:


chemaxon.formats.MolFormatException: Cannot recognize format (base64 or chime?)
Unrecognized file contents:
null
 at chemaxon.formats.recognizer.RecognitionSubsystem.getFormat(RecognitionSubsystem.java:203)
 at chemaxon.formats.MolInputStream.initTextFormat(MolInputStream.java:235)
 at chemaxon.formats.MolInputStream.init(MolInputStream.java:134)
 at chemaxon.formats.MolInputStream.<init>(MolInputStream.java:116)
 at chemaxon.formats.MolInputStream.<init>(MolInputStream.java:58)
 at chemaxon.util.MolHandler.importMol(MolHandler.java:652)
 at chemaxon.util.MolHandler.setMolecule(MolHandler.java:176)
 at chemaxon.util.MolHandler.<init>(MolHandler.java:125)
 at chemaxon.jchem.db.UpdateHandler.readMolecule(UpdateHandler.java:1318)
 at chemaxon.jchem.db.UpdateHandler.init(UpdateHandler.java:1107)
 at chemaxon.jchem.db.UpdateHandler.execute(UpdateHandler.java:2200)


please see attachments.


save function as:


Connection conn = this.getConnection();
  String structureTableName = Constants.STRUCTURE_TABLE_NAME;
  ConnectionHandler ch = new ConnectionHandler();
  UpdateHandler uh = null;
     try {
       ch.setConnection(conn);
       uh = new UpdateHandler(ch, isInsert ? UpdateHandler.INSERT : UpdateHandler.UPDATE,structureTableName, "");
       uh.setDuplicateFiltering(true);
       uh.setStructure(molfile);
       uh.setEmptyStructuresAllowed(true);
       uh.setDuplicateFiltering(false);
       if (!isInsert) { uh.setID(cdId); }
       return uh.execute(true);
     } catch (Exception e) {
      e.printStackTrace();
     } finally {
      try {
        uh.close();
      } catch (Exception e) {
       e.printStackTrace();
      }
     }


Any suggestions? thanks in advance.


 

ChemAxon e274e1bada

01-06-2010 16:41:36

Hi,


I tried to import the molfile which you sent, and it inserted successfully.


I have some questions:
- which  was the table type? The specified structure can be inserted to any, markush or query table type.
- Is it possible that the user tried to import  the structure as an image or a binary format? It is not clear from your code snipplet what is the source of the uh.setStructure(molfile)


Regards, Edvard

User 715e498bfb

02-06-2010 00:50:16

I test it in mysql, it works ok, but when i use sql server 2008, it can't work well. the structure table was created by jchemmanager with default setting. the attachment is the screen of jchemproperties table value.

ChemAxon e274e1bada

02-06-2010 07:32:16

Hi,


I will try to reproduce it with MS SQL 2008. I will inform you soon.


Regards, Edvard

ChemAxon e274e1bada

10-06-2010 07:56:32

Hi,


It is successfully imported to the MS SQL 2005 with Jchem 5.2.6 and other later versions.
It seems the type of the table where you tried to import the compound is a molecule table. The specified structure can be inserted to any,
markush or query table type.


Regards, Edvard