Obtaining license details via PLSQL API

User 952e1d9361

08-06-2010 13:07:14

Hello,


Is there a way I can retrieve license details (specifically expiration date) via the JChem cartridge PL/SQL API inside Oracle?


Thanks,


Steve

ChemAxon aa7c50abf8

08-06-2010 13:30:51

Hi Steve,


There is currently none. Would you need it badly?


Cheers,


Peter

User 952e1d9361

08-06-2010 13:38:01

Hi Peter,


No, it is not urgent.  It would just be helpful sometimes as it would enable us to track down 'obvious' problems (such as an expired license) on a simple 'system status' page.


Is the JChem version number available directly?  I guess this can be obtained by parsing the output of get_environment though...


Steve

ChemAxon aa7c50abf8

08-06-2010 13:48:15

Hi Steve,


No, it is not urgent.  It would just be helpful
sometimes as it would enable us to track down 'obvious' problems (such
as an expired license) on a simple 'system status' page.


Yes, this make sense.


Are you versed in Java well enough to create a custom function, provided there was public Java API available for this purpose? (There is currently no public Java API for this, but if users need this kind of information from PL/SQL, they might need it from Java as well.)


Is the JChem version number available directly?  I guess this can be obtained by parsing the output of get_environment though...

Exactly


Peter

User 952e1d9361

08-06-2010 14:00:40

Yes, we'd be able to do that I'm sure.


Steve

ChemAxon aa7c50abf8

08-06-2010 14:21:20

I asked my colleagues to check if this part can be made public.


In the mean time here is how you can use the Java API :


import chemaxon.license.License;
import chemaxon.license.LicenseHandler;

...

ArrayList<License> licList = LicenseHandler.getInstance().getLicenses(null, null);
for (License lic : licList) {
String product = lic.getSoftware();
    String expDate = lic.getExpirationDate();
}

There appears to be a more generic method to access any attribute of a given product's license:


ArrayList<License> licList = LicenseHandler.getInstance().getLicenses(null, null);
for (License lic : licList) {
    int fieldCount = lic.getFieldCount();
for (int fieldIdx = 0; fieldIdx < fieldCount; fieldCount++) {
    String attribName = lic.getFieldName(fieldIdx);
        String attribValue = lic.getFieldValue(fieldIdx);
    }
}

Let me know if you need more help.


Peter

User 952e1d9361

08-06-2010 14:49:30

Thanks Peter.


Do you have a version of this code that doesn't use generics?  Sorry but I'm not that Java competent so wouldn't know what to change!


I'm using Oracle 10g which I believe only has J2SE 1.4.2 and generics aren't in that version.


Thanks.


Steve

ChemAxon aa7c50abf8

09-06-2010 07:17:05

Steve,


As the licensing information is handled in JChem Server, the Java implementation will have run in the JChem Server -- outside Oracle. That is why you have to include it on JChem Server's class path. Java 5 or later is required to run JChem Server.


Regards,


Peter