How do I maintain connection in many classes accessing data from mysql database? | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
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 Respuesta
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