Manage JChemProperties with JChem API

User dfeb81947d

21-09-2009 14:29:28

Dear support,


I would like to manage JChemProperties table using JChem API. For exemple creating news line for new structure tables (adding using JChem API all the prop_name and prop_value needed to run run structure searches). Or even updating the structure tables and jchemproperties table to a new version of jchem.


I saw that DatabaseProperties is used to insert element in JChemProperties. But I don't really understand how I can calculate the properties: "version", "creationTime" and "validityTimestamp".


Is there an automatic insertion or do I need to insert à Date object?


Thank you very much for your help.


 


Friendly,


Jack

ChemAxon e274e1bada

22-09-2009 14:33:50

Dear Jaques,


you don't need to manipulate the property table for running a structure search or adding a new compound to the structure table. The property table contains table properties and the values are calculated when a table created or regenerated with the JChem API or GUI.
"version", "creationTime" and "validityTimestamp" are updated automatically as well.


I recommend to use UpdateHandler for create and recalculate your tables, so the properties will be set well.


Regards, Edvard



User dfeb81947d

13-10-2009 08:40:32

Thank you very much for your reply it helped a lot.


Actually, I encountered one problem. JChemproperties belong to one schema, and Structures Tables belong to another schema (Structure Table which are Table and also view).


Using only JChem Tools, I can not create a Jchem environment that match my needs. So that's the reason why I have to create at least elements of JChemproperties using SQL INSERT command and create Structure Table, Tables, View, Sequences and Index by hand.


Unless there are other methods.


Thank you in advance for your Help,


Best Regards


Jack


--


For example I do


Properties propsClient = new Properties();
propsClient.put("user", "SCHEMA1");
propsClient.put("password", "PASS");
try {
DriverManager.registerDriver((Driver)
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance());
String connectString = "jdbc:oracle:thin:@host:port:sid";
Connection conn = DriverManager.getConnection(connectString, propsClient);
ConnectionHandler conh = new ConnectionHandler();
conh.setConnection(conn);
DatabaseProperties.createPropertyTable(conh);
/* Here JChemProperties has just been created */
StructureTableOptions sto = new StructureTableOptions();
sto.absoluteStereo = false;
sto.fp_numberOfEdges = 6;
sto.fp_numberOfInts = 32;
sto.fp_numberOfOnes = 2;
sto.name="SCHEMA2.STRUCTURETABLE";
UpdateHandler.createStructureTable(conh, sto);
/* Here SCHEMA1 has no privilege to create a table in Schema 2 (ORA-01031)*/
sto.absoluteStereo = false;
sto.fp_numberOfEdges = 6;
sto.fp_numberOfInts = 32;
sto.fp_numberOfOnes = 2;
sto.name="SCHEMA2.VIEW";
/* Here SCHEMA1 will try to create a table (without success because ORA-01031)
But actually SCHEMA2.VIEW is a view
*/
UpdateHandler.createStructureTable(conh, sto);
conh.close();
conn.close();
} catch (Exception e) {
e.printStackTrace();
}

ChemAxon e274e1bada

13-10-2009 14:12:42

Dear Jack,


It is possible to use a property table from different schemas. See the 'JChem Property Table' section in the 'JChem database concept': http://www.chemaxon.com/jchem/doc/guide/dbconcepts/index.html and the Multiuser support doc: http://www.chemaxon.com/jchem/doc/admin/multiuser.html


I guess, your problem arises from an entitlement













prolem. The documents above describes the requirements of the multi user environment.


Best Regards,


Edvard

User dfeb81947d

15-10-2009 13:41:56

Dear Edvard,


Thank you very much for your answer.


Actually my problem is slightly different... there is a unique JChemproperties table in a schema MAIN_SCHEMA and every structure table are in other schema (SCHEMA1 for table1, SCHEMA2 for table2). But MAIN_SCHEMA has no privilege to create table on SCHEMA1, SCHEMA2, ... and SCHEMA1, SCHEMA2 are not allowed to insert in MAIN_SCHEMA


So if I use a java.sql.Connection on MAIN_SCHEMA, there is SQLException when using UpdateHandler.createTable.


But if I grant MAIN_SCHEMA to create table on SCHEMA1, SCHEMA2, ... I can create thos tables, but there are no option in API to insert into JChemproperties VIEWS created, aren't they? So I need to insert those line "table.SCHEMA1.view" using SQL, or do I have missed a property in JChem API?


Thank you so far for your help.


Best Regards,


Jacques

ChemAxon 9c0afc9aaf

19-10-2009 02:19:18

Hi,


 


but there are no option in API to insert into
JChemproperties VIEWS created, aren't they?



JChem Base does not support views.


So I need to insert those
line "table.SCHEMA1.view" using SQL, or do I have missed a property in
JChem API?



Yes your only option is to use SQL to do that.


Please note that this is outside of normal operation of JChem Base, this "hacking" is neither recommended nor supported by ChemAxon.


If you cannot avoid using views I suggest considering the use of JChem Cartridge for Oracle:


http://www.chemaxon.com/product/jc_cart.html


 


Best regards,


 


Szilard


 


 



User dfeb81947d

21-10-2009 15:14:46

Thank you very much for your answer.