How do I maintain connection in many classes accessing data from mysql database? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

How do I maintain connection in many classes accessing data from mysql database?

9th Aug 2016, 4:40 AM
Patrick Wambugu
Patrick Wambugu - avatar
1 Resposta
0
I had a job where i had to do this, and the best solution i found is to make an object, which is when created starts a connection. Instantiate it in your main class, then you can communicate with it from everywhere else.
22nd Aug 2016, 8:39 AM
MolnƔr GƔbor
MolnƔr GƔbor - avatar