Error while script is running

User 247c00dc1d

14-06-2016 13:42:23

Hello, when I run the script, which imports data from one table to another, time to time appears error:


 EROROR Failed to load ID 8099 org.springframework.dao.DataAccessResourceFailureException: No current connection.; SQL []; No current connection.; nested exception is java.sql.SQLNonTransientConnectionException: No current connection.
EROROR Failed to load ID 8100 org.springframework.dao.DataAccessResourceFailureException: No current connection.; SQL []; No current connection.; nested exception is java.sql.SQLNonTransientConnectionException: No current connection.
EROROR Failed to load ID 8101 org.springframework.dao.DataAccessResourceFailureException: No current connection.; SQL []; No current connection.; nested exception is java.sql.SQLNonTransientConnectionException: No current connection.


Moreover, one time it could be at first record, but next time at 5000th, how could it be fixed?


The typical script  


import com.im.commons.progress.*
import com.im.df.api.chem.MarvinStructure
import chemaxon.jep.Evaluator
import chemaxon.jep.context.MolContext
import chemaxon.formats.MolExporter

def parent = dataTree.rootVertex.entity
def rs = parent.schema.dataProvider.getDefaultResultSet(dataTree, false, DFEnvironmentRO.DEV_NULL)
def parentVS = rs.getVertexState(dataTree.rootVertex)

def molIDs = parentVS.getIds()
println "Найдено $molIDs.size строк (IDs) для экспорта"


def protoEdge = dataTree.rootVertex.edges.find { it.destination.entity.name == 'test' }
def protoEntity = protoEdge.destination.entity
def protoEdp = protoEntity.schema.dataProvider.getEntityDataProvider(protoEntity)


def testresult1 = protoEntity.fields.items.find {it.name == "testresult1"}
def testresult2 = protoEntity.fields.items.find {it.name == "testresult2"}
def Description = protoEntity.fields.items.find {it.name == "Description"}


//##############################################################################################################

def name = parent.fields.items.find { it.name == "name" }
def testresult1 = parent.fields.items.find { it.name == "testresult1" }
def testresult2 = parent.fields.items.find { it.name == "testresult2" }
def m1 = parent.fields.items.find { it.name == "A" }
def m2 = parent.fields.items.find { it.name == "B" }
def m3 = parent.fields.items.find { it.name == "C" }
i=0
try {
def lock = protoEdp.lockable.withLock('inserting data'){ envRW ->

molIDs.each { id ->

i++
// stop if the script is terminated
if (env.getFeedback().isCancelled())
{
def msg = "Exporting data to file interupted in the record $i!"
println msg
throw new InterruptedException(msg)
}

try {
//Fetch in the molecule from the structures table
def data = parentVS.getData([id], DFEnvironmentRO.DEV_NULL)
getMol = data[id][molFld.id]
nativeMol = getMol.getNative()
def nativeStr = MolExporter.exportToFormat(nativeMol, "smiles")

def vname = data[id][name.id]
def vtestresult1 = data[id][testresult1.id]
def vtestresult2 = data[id][testresult2.id]
def m1g = data[id][m1.id]
def m2g = data[id][m2.id]
def m3g = data[id][m3.id]

def masses = [m1g, m2g, m3g]

masses.each { m ->
vals = [:]
if (m)
{

vals.putAt(Description.id, vname)
vals.putAt(testresult1.id, vtestresult1)
vals.putAt(testresult2.id, vtestresult2)

protoEdp.insert(vals, null, envRW)
}
i++
}

} catch (Exception exc) {
println "EROROR Failed to load ID $id ${exc.toString()}"
}
}

}} finally {

}



Thanks,

Igor

ChemAxon 91ac526de6

12-07-2016 14:15:12

Hello Igor ,


what kind of database do you use? i have quickly gone through the script and it seems to be ok (only you twice define and therefore overwrite testresult1, testresult2 which is a bit weird). Anyway from the error you mention it looks like something related to the database is wrong. I looked that up on the web and maybe there is something wrong with the connection (see http://stackoverflow.com/questions/13490821/connection-exception-using-spring-jdbc-template).


Is the database you use very large?


Ondrej

User 247c00dc1d

13-07-2016 06:51:30

Hello Ondrej,


I use usual instant JChem DB, yes it is enough large

ChemAxon 91ac526de6

13-07-2016 12:18:34

Hello Igor,


 


It seems there is some problem with connection time-out. Please look to our documentation at the following link


https://docs.chemaxon.com/display/docs/Editing+Schema+Connection+Settings


Maybe you could try to increase connection timeout values.


Ondrej

ChemAxon 91ac526de6

13-07-2016 12:50:28

Hi Igor,


 


another thing, which version of IJC do you use? Has this always happened to you or is it result of some version update?


Ondrej

User 247c00dc1d

13-07-2016 12:57:26

Ondrej, I use the latest version of IJC, this happens in 99% :(

ChemAxon 91ac526de6

13-07-2016 13:15:26

We are not quite sure what is the problem, because we have never seen it before. I suppose you are using local Derby database.


I suggest you do 2 things:


1) can you isolate using try/catch syntax the row at which the error happens? (sorry, we cannot reproduce it...)


2) could you try to build your database using eg mySQL or Oracle?