If I remember correct, in AS5 there is a property use-java-context that you can set to access the datasource outside the server-jvm. See datasource configuration.
But I'm not sure whether this will work in AS6.
In AS7 there is no way to access the datasource pool outside the server.