Hi.
I've created a widget which gets the data from an other database.
So i've created a second db connection in the widget.
Now i want 2 or more widgets which gets there data from the other connection.
What would be the best way to do that?
ATM i open the connection, send the query to get the data, close the connection.
In the second widget the same thing is happening.
Now i thought to create a singleton class for the db connection, so i don't have to open & close it in every widget.
Would that be better?
Where should i than close the connection?
I've created a widget which gets the data from an other database.
So i've created a second db connection in the widget.
Now i want 2 or more widgets which gets there data from the other connection.
What would be the best way to do that?
ATM i open the connection, send the query to get the data, close the connection.
In the second widget the same thing is happening.
Now i thought to create a singleton class for the db connection, so i don't have to open & close it in every widget.
Would that be better?
Where should i than close the connection?
Comment