Assume a situation where the database server is restarted. Will a website on the server work without any problem i.e will the app server be able to detect if the database server is up or not or would we have to restart the app server?
Some servers would pick up the missing database immediately and start producing errors to the servers log file. This is usually the case if you use standard data sources such as in J2EE.
Other servers (or if the database connection is hard-coded via JDBC calls in the application code) would only detect errors if database queries were issued while the database was down. After all, you can't run queries on a server that isn't available.
In all cases though, the application server should be able to detect when the database server is back up and start working again. The only downside is that if you have any cached objects from the database on the application server, they may need to be resynched, ergo a restart of the application server may be required if your persistence manager does not handle this. [ December 07, 2005: Message edited by: Scott Selikoff ]
Oh and as a side note, application servers restart far more frequently than database servers (which I almost never restart) so its probably a good practice to take the application server down if you are restarting the database. In most situations, there's not much an application server can do while its database is down anyway. [ December 07, 2005: Message edited by: Scott Selikoff ]
Joined: May 17, 2005
Thanks. So what is the whole concept of Stale Connections?
That's just the name or type of exception an application is going to receive while the database is unavailable from the Connection object. A new Connection object must be established after some specified retry delay, or a failure must be reported to the user.
What's more, database connections are just fancy network connections, which sometimes are dropped for no discernible reason. So even if the DB is up all the time, the connection can go stale. That's why any decent DB connection pool will close and reopen DB connections every so often.
Ping & DNS - updated with new look and Ping home screen widget