Thanks in advance for even looking at this request. The line is from the code example listed in the article " JDBC Connection Pooling Best Practices" by David Murphy, JNetDirect
I have listed whole the method definition below to provide some context, but the line in question is the 3rd line. I see that it is an assignment of everything to the right of "=" to a boolean variable called poolingEnabled and I recognize the "==" operator as being a comparison of the string variable queryStr with the ORed expressions to the right of the equality operator, but it gets a bit complicated figuring out the possible values of " !queryStr.equals("disablePooling") ". So if someone could explain that bit , I would sure appreciate it because I would really like to understand what is going on rather than just accept that it works. Thanks again. PL
The "queryStr == null" is to make sure that "queryStr.equals" is not going to throw a NullPointerException. If it's null, the string value is not evaluated, pooling is enabled. If it's not null, the string value is evaluated, and pooling is enabled is the string is not equal to "disablePooling".
Would you understand it better if it were written :
Yes Christphe, I do see it better both ways you demonstrated, The First way is the easiest to logically folllow ( for me ) But I do see that the 2nd way does the same thing with less coding. S oto summarize the absence of parameter string ( null ) will default to connection pooling and connection pooling must be explicitly turned off by including the disablePooling parameter.
Thanks so much for answering my request . PL
P.S. If you have just another minute or two , Please let me know if the following supposition is true. I am thinking that as far as the DB Server is concerned , any connections in the pool are indeed open even though not actively working for any client and further that any client taking a connection from the pool must have already passed some type of authentcation. Thanks again
subject: Would someone please decipher a line of code for me