-2

I know we can use a single connection for different databases but why an option of multiple connection is provided, in other words, when is the correct situation to use multiple connections when we create a database or a table? Sorry if my question seems vague or imprecise to anyone but i am a novice and hence dont have much knowledge about database management.

1
  • Your question does look unclear, although if I was aware of Rick's answer, I probably wouldn't have voted to put it on hold. The most confusing bit to me personally is where you are talking about creation of a database or table. Typically, databases and tables are created as part of the design process using some management tool rather than your application. In such cases you just don't need to care about the number of connections at all.
    – Andriy M
    Commented Apr 12, 2016 at 8:40

1 Answer 1

1

Two separate users connecting to the same web site will get two separate application connections, each of which will make a separate connection to the database. But this is not what you are asking about?

One application program could make two connections to the database. But this is almost never a good idea. For web usage, connect when you start, use that one connection until the end of the web page.

There is no problem having one application connection INSERT/SELECT/etc with many different tables and even different databases. (By "database" I refer to CREATE DATABASE, not "server".)

One example exception... If you have a 'library' that does some kind of 'logging', it could have its own connection, separate from your application's connection.

A more advanced exception... If you have databases on different servers, then you must have a separate connection for each server.

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.