Hi,
I wonder whether Should getConnection() be placed in Init() of a servlet in the situation that multiple users concurrently access DB using service method. My though is, if we place getConnection() in Init() and dbConn is member variable instead of local variable then multiple users have to share a single connection to database. This is resource saving but user will have to wait till other finish using the connection if there're more than one users concurrently accessing DB through the service method.
My thought is lookup DB is placed in init() but getConnection is placed in service method, your thought?
I wonder whether Should getConnection() be placed in Init() of a servlet in the situation that multiple users concurrently access DB using service method. My though is, if we place getConnection() in Init() and dbConn is member variable instead of local variable then multiple users have to share a single connection to database. This is resource saving but user will have to wait till other finish using the connection if there're more than one users concurrently accessing DB through the service method.
My thought is lookup DB is placed in init() but getConnection is placed in service method, your thought?