User 73ad691ca3
21-08-2012 09:59:25
Hi, We are going to implement "the exporting of structure with data from structure table and other data tables" using the Jchem .Net API(i.e,. custom export, based on the select query). So we are using "Exporter class of jchem" to export the sdf data from structure table based on the select query. When we try to export the sdf data using "Exporter class of jchem", jchem throws exception. Jchem throws the exception when we set "the select query" to the exporter object. Exception: Transfer exception: Unexpected error during DB export init: null ---- Jchem version details: -->JChem .NET API 5.10.3.437 -->Oracle database Note: But when we try to export the sdf data for "the entire structure table"(i,e. setTableName method), we are able to get the exported results from the jchem exporter class. Below is the code we used for exporting structure data(i,e,. setSelectQuery), for this jchem throws exception: /////////////////////////////////////////////////////// using setSeletQuery ///////////////////////////////////////////////// using System; namespace JChemBaseSearch } private static ConnectionHandler getConnectionHandler() try ConnectionHandler ch = new ConnectionHandler(); return ch; public void ExportQueryData() string QUERY = "SELECT T.CD_STRUCTURE, T.CD_ID, B.BATCH_NUMBER FROM TEST T INNER JOIN BATCH_DETAILS B ON T.CD_ID = B.CD_ID"; //"SELECT TEST.CD_STRUCTURE FROM TEST WHERE TEST.CD_ID = 478"; int format = Transfer.__Fields.SDFILE; //Note: comment below 2 lines, if you want to export the data of query results ex.setOutputStream(os); //Note: uncomment below line, if you want to export the data from the structure table(here it is "test") int written = ex.writeAll(); } } //////////////////////////////////////////////////////////////////////////// //////////////Code to export structure data from a table/////////////this is working fine////////////////////// using System; namespace JChemBaseSearch } private static ConnectionHandler getConnectionHandler() try ConnectionHandler ch = new ConnectionHandler(); return ch; public void ExportQueryData() string QUERY = "SELECT T.CD_STRUCTURE, T.CD_ID, B.BATCH_NUMBER FROM TEST T INNER JOIN BATCH_DETAILS B ON T.CD_ID = B.CD_ID"; //"SELECT TEST.CD_STRUCTURE FROM TEST WHERE TEST.CD_ID = 478"; int format = Transfer.__Fields.SDFILE; //Note: comment below 2 lines, if you want to export the data of query results ex.setOutputStream(os); //Note: uncomment below line, if you want to export the data from the structure table(here it is "test") int written = ex.writeAll(); } } ///////////////////////////////////////////////////////// Please resolve this issue asap. we are waiting for your reply, and help us how to solve this issue. We want the export functionality to be working fine. Please let us know, if you need any other information regarding this. Thanks and Regards, D.Senthil kumar vijai.
using System.Collections.Generic;
using System.Linq;
using System.Text;
using java.io;
using System.Configuration;
using chemaxon.util;
using java.sql;
using chemaxon.jchem.db;
{
public class Exporter1
{
public Exporter1()
{
{
string url = ConfigurationManager.AppSettings["url"];//jdbc:oracle:thin:@dbora:1521:jchem
string username = ConfigurationManager.AppSettings["username"];//jcm
string password = ConfigurationManager.AppSettings["password"];//jcm
{
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection conn = DriverManager.getConnection(url, username, password);
ch.setConnection(conn);
}
catch (Exception ex)
{
throw ex;
}
}
{
try
{
//Note: create the folder, "c:/test"
string fileName = "c:/test/sdfTest12345.sdf";
string tname = "test";
File file = new File(fileName);
OutputStream os = new FileOutputStream(file);
Exporter ex = new Exporter();
ex.setConnectionHandler(getConnectionHandler());
//ex.setTableName(tname);
//ex.setDefaults(false);
ex.setFormat(format);
ex.setSelectStatement(QUERY); //when we uncomment this line, we get error. To do:
}
catch (Exception ex)
{
throw ex;
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
using java.io;
using System.Configuration;
using chemaxon.util;
using java.sql;
using chemaxon.jchem.db;
{
public class Exporter1
{
public Exporter1()
{
{
string url = ConfigurationManager.AppSettings["url"];//jdbc:oracle:thin:@dbora:1521:jchem
string username = ConfigurationManager.AppSettings["username"];//jcm
string password = ConfigurationManager.AppSettings["password"];//jcm
{
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection conn = DriverManager.getConnection(url, username, password);
ch.setConnection(conn);
}
catch (Exception ex)
{
throw ex;
}
}
{
try
{
//Note: create the folder, "c:/test"
string fileName = "c:/test/sdfTest12345.sdf";
string tname = "test";
File file = new File(fileName);
OutputStream os = new FileOutputStream(file);
Exporter ex = new Exporter();
ex.setConnectionHandler(getConnectionHandler());
ex.setTableName(tname);
ex.setDefaults(false);
ex.setFormat(format);
//ex.setSelectStatement(QUERY); //when we uncomment this line, we get error. To do:
}
catch (Exception ex)
{
throw ex;
}
}