fixed a bug when executing dataAccess.js

When executing a query, the connection obj might have been closed by transaction.js due to error elsewhere such as connection timeout, so a check must be performed on connection.isConnected() before executing any query.