What you mean by 'global variable'?
If you 'close' a connection from application side it is only marked that it can be returned to the pool.
If you left open ResultSets or Statements it will be also end in a DB-cursor leak (except you set the tracking in the DS file )
So you have to reset your variables yourself, or you might add a SQL comand that 'check' the connection getting from pool.
See http://community.jboss.org/wiki/configdatasources for this.
I am using Container Managed EJBs, so there should not be any problem with closing resultsets or statements.
And by global variables, i mean oracle global variables that are acccessible across different procedures in the same oracle session.
Those variables are reset only when you manually reset them or open a new oracle connection.
So as I understand correct you want to reset this variable for the next use?
Does the <valid-connection-checker-class-name> Element (see link above) of the datasource help if you implement a class to reset the connection?