1

I am developing a server application, which uses mysql for some data storing. Should I create a connection to the mysql on the server's start and use it for all queries, or create connection on each query? Which is better/faster?

TMS
  • 43
  • 1
  • 12
  • Possible duplicate of http://stackoverflow.com/questions/880885/is-closing-the-mysql-connection-important – WebNovice Oct 13 '13 at 12:58
  • @WebNovice Rather than blaming me for duplicating posts which's question is different from this, you could add some good answers for this question. – TMS Oct 13 '13 at 13:46

1 Answers1

1

If you ask me, It's better to use only one connection, that way you can use session variables without any issues. Besides, with static variables, it's easy to permanently save the connection somewhere in the script.

Adam Fowler
  • 1,750
  • 1
  • 17
  • 18