Normally you shouldn't need that. In most cases what you need is a database connection or a persistence context, leaving the pooling of the former to the app server. Are you sure you actually need the credentials?
In this case, I need to write user and password database to cookie,
and the other application will be read this user and password from cookie.