Re: dbcp is mixing up connections
Mark: I'm just declaring variables there, no putting logic. You had overlooked log4jdbc, if you have read books in the same way Library log4jdbc is COOL! Works very Well, is really a good library that helps me a lot, without it I cannot see what really is happening behind the scenes. Bravo log4jdbc : http://code.google.com/p/log4jdbc/!! Terence: I had read the same, the first time I started a JSP page and rereaded it yesterday: http://java.sun.com/products/jsp/pdf/jsptut.pdf. Maybe I had been never understood how JSP/Beans works or maybe this kind programing language simply does not fit. I'm not an expert but in past I worked a with MVC, Swing and JAVA: Cool stuff, but I never have seen how it helps in the web development. Java turned into the web, makes huge amount of writing (the exact formula is : lines_of_JSP_code = lines_of_PHP_code * 10) no way to fit objects/classes, into Web Application needs. Have you seen Hashes in PHP? try to use them in java... Ehhh and don't put an Integer into a HashMap and try to get a String!! You have to then Integer Values with a Try() Catch(), Swith statement does not support Strings!!!... thinks like this fucks a lot! PHP is a hundred times more versatile for Web, and there is lots and lots of support: lib GD is great, making PDFs is preatty simple almost every problem you are going to face is resolved and published somewhere, you only have to Google a little. I think PHP makes sense, of course in conjunction with a good framework. I'm going to read a lot of books but not about JavaServer(TM) (Oracle). Este mensaje se dirige exclusivamente a su destinatario. Contiene informacin CONFIDENCIAL sometida a secreto profesional o cuya divulgacin est prohibida por Ley. Si ha recibido este mensaje por error, debe saber que su lectura, copia y uso estn prohibidos. Le rogamos nos lo comunique inmediatamente por esta misma va o por telfono 93 600 36 00 y proceda a su destruccin. El correo electrnico va Internet no permite asegurar la confidencialidad de los mensajes que se transmiten ni su integridad o correcta recepcin. TEMPEL S.A. no asume responsabilidad por estas circunstancias. Si el destinatario de este mensaje no consintiera la utilizacin del correo electrnico va Internet y la grabacin de los mensajes, rogamos lo ponga en nuestro conocimiento de forma inmediata. En cumplimiento de la Ley Orgnica 15/1999, de 13 de diciembre, de Proteccin de Datos de Carcter Personal le informamos de que sus datos personales y de empresa pasarn a formar parte de un fichero registrado ante la Agencia Espaola de Proteccin de Datos. Los datos personales que existen en nuestro poder estn protegidos por nuestra Poltica de Seguridad, y no sern compartidos con ninguna otra empresa. Usted puede ejercitar sus derechos de acceso, rectificacin, cancelacin y oposicin dirigindose por escrito a c/ Cobalto, 4 08907 L'Hospitalet de LLobregat (Barcelona). El 16/12/2011 3:32, Mark Eggers escribi: ral people
Re: dbcp is mixing up connections
On 16 Dec 2011, at 09:32, Aitor Garcia | Tempel.es agar...@tempel.es wrote: Mark: I'm just declaring variables there, no putting logic. You had overlooked log4jdbc, if you have read books in the same way Library log4jdbc is COOL! Works very Well, is really a good library that helps me a lot, without it I cannot see what really is happening behind the scenes. Bravo log4jdbc : http://code.google.com/p/log4jdbc/!! Terence: I had read the same, the first time I started a JSP page and rereaded it yesterday: http://java.sun.com/products/jsp/pdf/jsptut.pdf. Maybe I had been never understood how JSP/Beans works or maybe this kind programing language simply does not fit. I'm not an expert but in past I worked a with MVC, Swing and JAVA: Cool stuff, but I never have seen how it helps in the web development. Java turned into the web, makes huge amount of writing (the exact formula is : lines_of_JSP_code = lines_of_PHP_code * 10) no way to fit objects/classes, into Web Application needs. Have you seen Hashes in PHP? try to use them in java... Ehhh and don't put an Integer into a HashMap and try to get a String!! You have to then Integer Values with a Try() Catch(), Swith statement does not support Strings!!!... thinks like this fucks a lot! PHP is a hundred times more versatile for Web, and there is lots and lots of support: lib GD is great, making PDFs is preatty simple almost every problem you are going to face is resolved and published somewhere, you only have to Google a little. I think PHP makes sense, of course in conjunction with a good framework. I'm going to read a lot of books but not about JavaServer(TM) (Oracle). I think you're on the wrong mailing list. p AITOR_GARCIA.jpg Este mensaje se dirige exclusivamente a su destinatario. Contiene información *CONFIDENCIAL* sometida a secreto profesional o cuya divulgación está prohibida por Ley. Si ha recibido este mensaje por error, debe saber que su lectura, copia y uso están prohibidos. Le rogamos nos lo comunique inmediatamente por esta misma vía o por teléfono 93 600 36 00 y proceda a su destrucción. El correo electrónico vía Internet no permite asegurar la confidencialidad de los mensajes que se transmiten ni su integridad o correcta recepción. *TEMPEL S.A.* no asume responsabilidad por estas circunstancias. Si el destinatario de este mensaje no consintiera la utilización del correo electrónico vía Internet y la grabación de los mensajes, rogamos lo ponga en nuestro conocimiento de forma inmediata. En cumplimiento de la Ley Orgánica 15/1999, de 13 de diciembre, de Protección de Datos de Carácter Personal le informamos de que sus datos personales y de empresa pasarán a formar parte de un fichero registrado ante la Agencia Española de Protección de Datos. Los datos personales que existen en nuestro poder están protegidos por nuestra Política de Seguridad, y no serán compartidos con ninguna otra empresa. Usted puede ejercitar sus derechos de acceso, rectificación, cancelación y oposición dirigiéndose por escrito a c/ Cobalto, 4 08907 L'Hospitalet de LLobregat (Barcelona). El 16/12/2011 3:32, Mark Eggers escribió: ral people
Re: dbcp is mixing up connections
On 1:59 PM, Pid * wrote: On 16 Dec 2011, at 09:32, Aitor Garcia | Tempel.es agar...@tempel.es wrote: Mark: I'm just declaring variables there, no putting logic. You had overlooked log4jdbc, if you have read books in the same way Library log4jdbc is COOL! Works very Well, is really a good library that helps me a lot, without it I cannot see what really is happening behind the scenes. Bravo log4jdbc : http://code.google.com/p/log4jdbc/!! Terence: I had read the same, the first time I started a JSP page and rereaded it yesterday: http://java.sun.com/products/jsp/pdf/jsptut.pdf. Maybe I had been never understood how JSP/Beans works or maybe this kind programing language simply does not fit. I'm not an expert but in past I worked a with MVC, Swing and JAVA: Cool stuff, but I never have seen how it helps in the web development. Java turned into the web, makes huge amount of writing (the exact formula is : lines_of_JSP_code = lines_of_PHP_code * 10) no way to fit objects/classes, into Web Application needs. Have you seen Hashes in PHP? try to use them in java... Ehhh and don't put an Integer into a HashMap and try to get a String!! You have to then Integer Values with a Try() Catch(), Swith statement does not support Strings!!!... thinks like this fucks a lot! PHP is a hundred times more versatile for Web, and there is lots and lots of support: lib GD is great, making PDFs is preatty simple almost every problem you are going to face is resolved and published somewhere, you only have to Google a little. I think PHP makes sense, of course in conjunction with a good framework. I'm going to read a lot of books but not about JavaServer(TM) (Oracle). I think you're on the wrong mailing list. p But thanks for stopping by. -Terence AITOR_GARCIA.jpg Este mensaje se dirige exclusivamente a su destinatario. Contiene información *CONFIDENCIAL* sometida a secreto profesional o cuya divulgación está prohibida por Ley. Si ha recibido este mensaje por error, debe saber que su lectura, copia y uso están prohibidos. Le rogamos nos lo comunique inmediatamente por esta misma vía o por teléfono 93 600 36 00 y proceda a su destrucción. El correo electrónico vía Internet no permite asegurar la confidencialidad de los mensajes que se transmiten ni su integridad o correcta recepción. *TEMPEL S.A.* no asume responsabilidad por estas circunstancias. Si el destinatario de este mensaje no consintiera la utilización del correo electrónico vía Internet y la grabación de los mensajes, rogamos lo ponga en nuestro conocimiento de forma inmediata. En cumplimiento de la Ley Orgánica 15/1999, de 13 de diciembre, de Protección de Datos de Carácter Personal le informamos de que sus datos personales y de empresa pasarán a formar parte de un fichero registrado ante la Agencia Española de Protección de Datos. Los datos personales que existen en nuestro poder están protegidos por nuestra Política de Seguridad, y no serán compartidos con ninguna otra empresa. Usted puede ejercitar sus derechos de acceso, rectificación, cancelación y oposición dirigiéndose por escrito a c/ Cobalto, 4 08907 L'Hospitalet de LLobregat (Barcelona). El 16/12/2011 3:32, Mark Eggers escribió: ral people - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: [OT] dbcp is mixing up connections
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Aitor, (Marking OT because this has nothing to do with Tomcat or even with the original thread. I may be feeding a troll, here. Apologies in advance.) On 12/16/11 4:31 AM, Aitor Garcia | Tempel.es wrote: I'm not an expert but in past I worked a with MVC, Swing and JAVA: Cool stuff, but I never have seen how it helps in the web development. MVS is an architectural design suggestion, and it applies pretty much everywhere. I can show you how how MVC pattern can be applied to a variety of tasks from writing a compiler to writing scripting engine and GUI to control turbine-engine test beds. Swing doesn't help you in web development, but if you've written your Swing-based apps properly, then replacing the Swing front-end with a web-based one should require only the replacement of the interface code: no migration of JDBC calls, etc. Java turned into the web, makes huge amount of writing (the exact formula is : lines_of_JSP_code = lines_of_PHP_code * 10) no way to fit objects/classes, into Web Application needs. That's funny... when I write PHP, I long for Java. I'm kind of a stickler for proper resource management, and having to check every single db_query(...) call for an error code, then clean-up all the statements I've executed and results I've fetched, then close the connection and repeat the same code over and over and over again seems like a waste of typing. As for [fitting] objects/classes into Web Application needs, I suspect that you haven't really made the leap from procedural programming into object-oriented programming. I'm not suggesting that one is better than the other -- just that there really is a completely different mindset when writing with objects in mind. I used to get irritated when everyone used the term paradigm shift to describe it, so I won't use that term, here. Damn. Have you seen Hashes in PHP? Yes, the syntax is charming. try to use them in java... Ehhh and don't put an Integer into a HashMap and try to get a String!! This is the difference between strongly-typed and loosely-typed languages. It's another one of those things you just have to get used to. The upside is that the runtime doesn't have to waste all it's time trying to figure out what type everything is and convert everything on the fly. You have to then Integer Values with a Try() Catch() You're doing it wrong if you have to use try/catch to fetch values from a hash table. Swith statement does not support Strings!!!... That's right: switch only supports primitive data types. You'll have to do things the long way and use a series of if. Oh, noes. thinks like this fucks a lot! I've entertained your rant long enough. Please don't use language like this on the list. It's really not necessary. When I can't get something working in PHP, I read the documentation and figure it out. I don't go into a PHP-related mailing list and make a complete ass out of myself by complaining about language features and how I hate using it. I'm going to read a lot of books but not about JavaServer(TM) (Oracle). I hope you enjoy your Bliss. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk7rz8YACgkQ9CaO5/Lv0PADpACgrSRrPQ9hU5hDvLgqJTDUtnP8 4RYAnimfublvv4klQ7e4VaaB4RimR/lZ =B+Ec -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: dbcp is mixing up connections
On 15/12/2011 12:12, Aitor Garcia | Tempel.es wrote: I don't know if this is a tomcat bug. This is clearly not a Tomcat bug. This comes under the category of user error. Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: dbcp is mixing up connections
I had read all the JNDI JDBC Official Unofficial documentation but only found than you MUST close the connections. There insn't references to where to declare variables. Declaring into local scope forces that you have pass by reference the connection, statement and resultset in every function that handle the pool os use a class to handle the connection itsef. Este mensaje se dirige exclusivamente a su destinatario. Contiene informacin CONFIDENCIAL sometida a secreto profesional o cuya divulgacin est prohibida por Ley. Si ha recibido este mensaje por error, debe saber que su lectura, copia y uso estn prohibidos. Le rogamos nos lo comunique inmediatamente por esta misma va o por telfono 93 600 36 00 y proceda a su destruccin. El correo electrnico va Internet no permite asegurar la confidencialidad de los mensajes que se transmiten ni su integridad o correcta recepcin. TEMPEL S.A. no asume responsabilidad por estas circunstancias. Si el destinatario de este mensaje no consintiera la utilizacin del correo electrnico va Internet y la grabacin de los mensajes, rogamos lo ponga en nuestro conocimiento de forma inmediata. En cumplimiento de la Ley Orgnica 15/1999, de 13 de diciembre, de Proteccin de Datos de Carcter Personal le informamos de que sus datos personales y de empresa pasarn a formar parte de un fichero registrado ante la Agencia Espaola de Proteccin de Datos. Los datos personales que existen en nuestro poder estn protegidos por nuestra Poltica de Seguridad, y no sern compartidos con ninguna otra empresa. Usted puede ejercitar sus derechos de acceso, rectificacin, cancelacin y oposicin dirigindose por escrito a c/ Cobalto, 4 08907 L'Hospitalet de LLobregat (Barcelona). El 15/12/2011 13:40, Mark Thomas escribi: On 15/12/2011 12:12, Aitor Garcia | Tempel.es wrote: I don't know if this is a tomcat bug. This is clearly not a Tomcat bug. This comes under the category of "user error". Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: dbcp is mixing up connections
On 15/12/2011 12:55, Aitor Garcia | Tempel.es wrote: I had read all the JNDI JDBC Official Unofficial documentation but only found than you MUST close the connections. There insn't references to where to declare variables. Declaring into local scope forces that you have pass by reference the connection, statement and resultset in every function that handle the pool os use a class to handle the connection itsef. Strongly recommend not doing any of this in a JSP. Look up MVC. p FIRMA Este mensaje se dirige exclusivamente a su destinatario. Contiene información *CONFIDENCIAL* sometida a secreto profesional o cuya divulgación está prohibida por Ley. Si ha recibido este mensaje por error, debe saber que su lectura, copia y uso están prohibidos. Le rogamos nos lo comunique inmediatamente por esta misma vía o por teléfono 93 600 36 00 y proceda a su destrucción. El correo electrónico vía Internet no permite asegurar la confidencialidad de los mensajes que se transmiten ni su integridad o correcta recepción. *TEMPEL S.A.*no asume responsabilidad por estas circunstancias. Si el destinatario de este mensaje no consintiera la utilización del correo electrónico vía Internet y la grabación de los mensajes, rogamos lo ponga en nuestro conocimiento de forma inmediata. En cumplimiento de la Ley Orgánica 15/1999, de 13 de diciembre, de Protección de Datos de Carácter Personal le informamos de que sus datos personales y de empresa pasarán a formar parte de un fichero registrado ante la Agencia Española de Protección de Datos. Los datos personales que existen en nuestro poder están protegidos por nuestra Política de Seguridad, y no serán compartidos con ninguna otra empresa. Usted puede ejercitar sus derechos de acceso, rectificación, cancelación y oposición dirigiéndose por escrito a c/ Cobalto, 4 08907 L'Hospitalet de LLobregat (Barcelona). El 15/12/2011 13:40, Mark Thomas escribió: On 15/12/2011 12:12, Aitor Garcia | Tempel.es wrote: I don't know if this is a tomcat bug. This is clearly not a Tomcat bug. This comes under the category of user error. Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org -- [key:62590808] signature.asc Description: OpenPGP digital signature
Re: dbcp is mixing up connections
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Aitor, On 12/15/11 7:12 AM, Aitor Garcia | Tempel.es wrote: 5) Tomcat, creates ONE (or maybe SOME) Class object and call to the _jspService on every script request What happens if you handle Pool Coonections with a 'java.sql.Connection conn' variable declared into the definitions block %! %? Happens than if you are donig multitheading and executing the same sctipt in parallel you will mix up connections because evey thead is executing the same method in parallel and putting a different connection into the java.sql.Connection conn class variable. I don't know if this is a tomcat bug. Obviously it's not. This is one of the many reasons why application logic has no business being in a JSP. Whoever proposed (and, indeed approved) the introduction of scriptlets (% ... %) should have been flogged. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk7qFLAACgkQ9CaO5/Lv0PBjBgCfeCtAcWmeoSWJsva+VGEevvnU xvoAoKCMa1i5YwxqbrHkiAeo9SKGe+Rr =0kQv -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: dbcp is mixing up connections
On 1:59 PM, Christopher Schultz wrote: Aitor, On 12/15/11 7:12 AM, Aitor Garcia | Tempel.es wrote: 5) Tomcat, creates ONE (or maybe SOME) Class object and call to the _jspService on every script request What happens if you handle Pool Coonections with a 'java.sql.Connection conn' variable declared into the definitions block %! %? Happens than if you are donig multitheading and executing the same sctipt in parallel you will mix up connections because evey thead is executing the same method in parallel and putting a different connection into the java.sql.Connection conn class variable. I don't know if this is a tomcat bug. Obviously it's not. This is one of the many reasons why application logic has no business being in a JSP. Whoever proposed (and, indeed approved) the introduction of scriptlets (% ... %) should have been flogged. -chris Hi, Aitor- Tomcat reuses JSP class instances in multiple threads. Variables defined in declarations blocks %! ... % result in member (or instance) variables. If you define instance variables, you have to ensure their usage is thread-safe. Variables defined in scriptlet blocks % ... % result in variables that are local to the JSP service method. -Terence Bandoian - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: dbcp is mixing up connections
On 1:59 PM, Christopher Schultz wrote: Aitor, On 12/15/11 7:12 AM, Aitor Garcia | Tempel.es wrote: 5) Tomcat, creates ONE (or maybe SOME) Class object and call to the _jspService on every script request What happens if you handle Pool Coonections with a 'java.sql.Connection conn' variable declared into the definitions block %! %? Happens than if you are donig multitheading and executing the same sctipt in parallel you will mix up connections because evey thead is executing the same method in parallel and putting a different connection into the java.sql.Connection conn class variable. I don't know if this is a tomcat bug. Obviously it's not. This is one of the many reasons why application logic has no business being in a JSP. Whoever proposed (and, indeed approved) the introduction of scriptlets (% ... %) should have been flogged. -chris Hi, Chris- From the Java Server Pages Specification: There are three language-based types of scripting elements: declarations, scriptlets, and expressions. Declarations follow the syntax %! ... %. Scriptlets follow the syntax % ... %. Expressions follow the syntax %= ... %. -Terence Bandoian - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: dbcp is mixing up connections
2011/12/15 Aitor Garcia | Tempel.es agar...@tempel.es I had read all the JNDI JDBC Official Unofficial documentation but only found than you MUST close the connections. That is why you have to read the Servlet specification, JSP specification, etc. There insn't references to where to declare variables. Declaring into local scope forces that you have pass by reference the connection, statement and resultset in every function that handle the pool os use a class to handle the connection itsef. Eh? There are many ways to write a program. Have you ever heard about encapsulation? About patterns (such as Design Patterns book by E.Gamma co)? http://www.ibookdb.net/isbn/0201633612 One more important thing to learn: You should NEVER send HTML e-mails and images to mailing lists. It wastes subscribers' bandwidth and storage area on archive servers. Please use plain text. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: dbcp is mixing up connections
- Original Message - From: Terence M. Bandoian tere...@tmbsw.com To: Tomcat Users List users@tomcat.apache.org Cc: Sent: Thursday, December 15, 2011 11:31 AM Subject: Re: dbcp is mixing up connections On 1:59 PM, Christopher Schultz wrote: Aitor, On 12/15/11 7:12 AM, Aitor Garcia | Tempel.es wrote: 5) Tomcat, creates ONE (or maybe SOME) Class object and call to the _jspService on every script request What happens if you handle Pool Coonections with a 'java.sql.Connection conn' variable declared into the definitions block %! %? Happens than if you are donig multitheading and executing the same sctipt in parallel you will mix up connections because evey thead is executing the same method in parallel and putting a different connection into the java.sql.Connection conn class variable. I don't know if this is a tomcat bug. Obviously it's not. This is one of the many reasons why application logic has no business being in a JSP. Whoever proposed (and, indeed approved) the introduction of scriptlets (% ... %) should have been flogged. -chris Hi, Chris- From the Java Server Pages Specification: There are three language-based types of scripting elements: declarations, scriptlets, and expressions. Declarations follow the syntax %! ... %. Scriptlets follow the syntax % ... %. Expressions follow the syntax %= ... %. -Terence Bandoian Lots of things are causing problems here. As many others have pointed out, instance variables are not thread safe. In short, do not put your business logic, database logic, or control logic in a JSP page. You will have problems. I suggest reading at least two books (plus the servlet spec as others have recommended). Head First Servlets and JSP by Bryan Basham, Kathy Sierra, and Bert Bates I've read the first edition. The second edition is out and highly reviewed. It covers a lot of material in a very approachable way. It does have a chapter at the end on MVC, but it is not a design book. Several people have mentioned the Design Patterns book by the Gang of Four (Gamma et. al). It's a great book, but you may or may not find it approachable. Head First Design Patterns by Freeman and Freeman is another approachable book, with examples and exercises in Java. It obviously covers design patterns. Even Erich Gamma was impressed (according to the praise page). Finally, I took a look at the library you're using to do logging. It appears that what you are trying to do is not supported. See the following two links: http://code.google.com/p/log4jdbc/wiki/FAQ http://code.google.com/p/log4jdbc/wiki/DataSourceExampleForWebSphere In short, it appears that without writing your own factory, you will not get the results you want with this library. Granted, I've not really explored the code that much so I could be completely wrong here. I do not have any affiliation with any of the books or authors mentioned. I just have found them good learning resources. just my two cents . . . . /mde/ - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org