I'm surprised that nobody mentioned BSD Sockets. With a Server app running (it could be a batch job running under the MPE CI), it would open the database, open a socket, and just sit back and wait. The client, which could be running under the shell, would send a socket request to the server, receive the reply, and display the results.