I recently attended an interview in java, the interviewer asked a question, as shown below:
I have a request that processes modules A, B, C and the response goes back to A, in the AI module you need to talk to the database, and again in the CI module you need to talk to the database, so in this situation how many connections will you open and where are you close these connections?
My answer: I said that the connection will open in the AI module, and I will close it then and there, and then go to module B, then module C, to module C I will open another connection again, and I will close it again. then he asked me another question again: I want to open one connection to process the request, how can I do this?
source
share