Hi. I am developing a website. I have a class that is a database connection. The class consists of methods that write and read from the database. Currently the class is static, as well as its methods. I call the class from web pages as follows:
//mydbClass is the name of the class , not an object
mydbClass.getUserName(userID)
Question: I need to create a class object so that every time a user requests a page a new object is created and it communicates with the database as follows:
mydbClass mydb = new mydbClass();
mydb.getUserName(userID)
Because if I do not create a new object in this way, all users who read or write to the database will use the same static object, then it will be very busy and maybe it will crash. I would like the answer thanks to Micah
source
share