Re: SQL tag not working
Karl Coleman wrote: I left out that it works on the application running with SQL Server 2000. -Original Message- From: Karl Coleman Sent: Wednesday, July 28, 2004 3:28 PM To: Tag Libraries Users List Subject: SQL tag not working This is killing me why this doesn't work. This is populating a SELECT. I have the exact same setup in another application. The only major difference is this use mysql, the one that works uses SQL Server 2000. Table name and columns are different too, but the point is the same thing; fill a SELECT with values. The query appears to return nothing. I get a select with just a comma (,) in it. sql:setDataSource driver=com.mysql.jdbc.Driver url=jdbc:mysql://localhost/FABL user= password= / sql:query var=result SELECT ID, FIRSTNAME, LASTNAME FROM CUSTOMERS ORDER BY LASTNAME, FIRSTNAME /sql:query select size=10 name=custid size=1 c:forEach items=${result.rows} var=row option value=${row.id}${row.lastname}, ${row.firstname}/option /c:forEach /select Thanks, Karl - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] I know SQL Server by default is not case sensitive for identifiers. I don't know about MySql but that's the first thing I'd eliminate. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: sql tag
I'd use sql:query in the JSP page, but Model-View-Controller (MVC) purists strongly discourage using the sql tags at all because they more tightly couple the View (JSP page) with the Model (database) which violates the MVC principle of Model-View separation. An MVC designer prefers that a JSP page indirectly access a datasource through Enterprise Java Beans (EJBs) or some other object-relational mapping system. In a basic JSP and EJB model, a JSP page refers to an EJB on an EJB server through a Java Bean or Expression Language (EL) object and the EJB server maps the EJB to a row in a database table. When the JSP page changes the EL object, it changes the EJB, which in turn updates the row in the table. Derek -Original Message- From: Karl Coleman [mailto:[EMAIL PROTECTED] Sent: May 11, 2004 4:53 PM To: Tag Libraries Users List Subject: sql tag What is the general consensus on the sql tag? I want to fill a drop down with values from a table in a database. Is it better to use the sql tag in the jsp or do it in the servlet the jsp is called from? Or is in 6 of one, half-dozen of the other? Thanks, Karl - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] NOTICE: This email contains privileged and confidential information and is intended only for the individual to whom it is addressed. If you are not the named addressee, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this transmission by mistake and delete this communication from your system. E-mail transmission cannot be guaranteed to be secured or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. AVIS: Le présent courriel contient des renseignements de nature privilégiée et confidentielle et nest destiné qu'à la personne à qui il est adressé. Si vous nêtes pas le destinataire prévu, vous êtes par les présentes avisés que toute diffusion, distribution ou reproduction de cette communication est strictement interdite. Si vous avez reçu ce courriel par erreur, veuillez en aviser immédiatement lexpéditeur et le supprimer de votre système. Notez que la transmission de courriel ne peut en aucun cas être considéré comme inviolable ou exempt derreur puisque les informations quil contient pourraient être interceptés, corrompues, perdues, détruites, arrivées en retard ou incomplètes ou contenir un virus. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: sql tag
It's to populate a drop down menu, so it is presentation related. Karl -Original Message- From: Helios Alonso [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 11, 2004 5:25 PM To: Tag Libraries Users List Subject: Re: sql tag In the second choice what did you mean? (sorry my english skills) a) servlet (post some data) and redirect to a JSP for some other choice b) JSP use a servlet or some kind of component Any case, it has to do with what is the arquitecture of your solution. You know, if you are building a nice layered system it's no good to use ANY sql stuff at visual level (JSP). But, if DB access is ok on your JSP, great. If you meant (a) then you are propossing that JSP receives the values to offer from the servlet... hmm.. I'd choose that only if you are using JSP as an utilitary template, not as a visual representation of some portion of the problem domain. If it does represent something meaning, it's better to encapsulate the logic in the JSP, or some internal component (again the layer thing), not distributing the clients the resposability (the client is the referrer servlet). Summary: a) template JSP, a referrer gives the values b) monolitic system/JSP, JSP obtains the values with a sql c) layered system, JSP queries a component with the logic encapsulated Hope it helps! Helios At 16:52 11/05/2004 -0400, you wrote: What is the general consensus on the sql tag? I want to fill a drop down with values from a table in a database. Is it better to use the sql tag in the jsp or do it in the servlet the jsp is called from? Or is in 6 of one, half-dozen of the other? Thanks, Karl - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: sql tag
In the second choice what did you mean? (sorry my english skills) a) servlet (post some data) and redirect to a JSP for some other choice b) JSP use a servlet or some kind of component Any case, it has to do with what is the arquitecture of your solution. You know, if you are building a nice layered system it's no good to use ANY sql stuff at visual level (JSP). But, if DB access is ok on your JSP, great. If you meant (a) then you are propossing that JSP receives the values to offer from the servlet... hmm.. I'd choose that only if you are using JSP as an utilitary template, not as a visual representation of some portion of the problem domain. If it does represent something meaning, it's better to encapsulate the logic in the JSP, or some internal component (again the layer thing), not distributing the clients the resposability (the client is the referrer servlet). Summary: a) template JSP, a referrer gives the values b) monolitic system/JSP, JSP obtains the values with a sql c) layered system, JSP queries a component with the logic encapsulated Hope it helps! Helios At 16:52 11/05/2004 -0400, you wrote: What is the general consensus on the sql tag? I want to fill a drop down with values from a table in a database. Is it better to use the sql tag in the jsp or do it in the servlet the jsp is called from? Or is in 6 of one, half-dozen of the other? Thanks, Karl - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: SQL tag library installation question
On Sat, 5 Jul 2003, Henri Yandell wrote: On Sat, 5 Jul 2003, Neil Zanella wrote: As it seems to me that Tomcat does not make use of the CLASSPATH variable at all (i.e. it does not read it when it is started) (is this correct?), then how can Tomcat possibly find on the system some JDBC driver such as org.postgresql.Driver installed on the system as a JAR file whose absolute path name is given by: /usr/lib/pgsql/jdbc7.0-1.2.jar You put the jar in Tomcat's common/lib/ directory. It's akin to the JVM's ext/ directory [where you could also put the jar, but that's a bit yucky]. Or symlink it to appear like it is there. Thanks. So what is the difference between $CATALINA_HOME/common/lib and $CATALINA_HOME/shared/lib. Are these two directory meant to be used for slightly different purposes? I cannot make out how Tomcat would know to look in such a place in the first place. Anyone know how it is done? Only way to make it look in /usr/lib would be to edit the startup scripts to put it in the CLASSPATH for the Tomcat. I guess the right place to modify the CLASSPATH that Tomcat uses would be inside the script $CATALINA_HOME/bin/setclasspath.sh which I is called by $CATALINA_HOME/bin/catalina.sh which is called by the startup script $CATALINA_HOME/bin/startup.sh . Also, is anyone using tomcat with Red Hat 9 and postgresql? I cannot seem to be able to start the postmaster with the -i flag (used to enable network connections, necessary for JDBC connections too apparently). Nope, I'm using SuSE/Tomcat/Postgres. To get my postgres to start with the right flags I change /etc/sysconfig/postgresql to include the line: POSTGRES_OPTIONS=-i but I suspect this is a SuSE only thing. I found a more portable way to start the postmaster with TCP/IP enabled: tcpip_socket = true BTW, I think RPM packages always leave out some files from the list: $ rpm -qf /var/lib/pgsql/data/postgresql.conf file /var/lib/pgsql/data/postgresql.conf is not owned by any package That's not very good. If your postgres was an rpm, look at the startup script [/etc/init.d/postgresql or /etc/rc.d/postgresql or something] and see if it looks for options in a file. Yes, there is a line export PGOPTS in /etc/init.d/postgresql and then the variable is not referenced anywhere else in the script. My guess is that some binary must read it with the getenv(3) UNIX call, but Red Hat does not even set a default value for PGOPTS, just exports it. Best Regards, Neil - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: SQL tag library installation question
Hi Neil, We put the JDBC jar file in $CATALINA_HOME/shared/lib. There our webapps can share it. Peter -- Peter Smith Software Engineer InfoNow Corporation From: Neil Zanella [EMAIL PROTECTED] Reply-To: Tag Libraries Users List [EMAIL PROTECTED] Date: Sat, 5 Jul 2003 18:15:07 -0230 (NDT) To: Taglibs User Mailing List [EMAIL PROTECTED] Subject: SQL tag library installation question Hello, I wonder whether anyone has been using the SQL tag library. I am wondering about the following: As it seems to me that Tomcat does not make use of the CLASSPATH variable at all (i.e. it does not read it when it is started) (is this correct?), then how can Tomcat possibly find on the system some JDBC driver such as org.postgresql.Driver installed on the system as a JAR file whose absolute path name is given by: /usr/lib/pgsql/jdbc7.0-1.2.jar I cannot make out how Tomcat would know to look in such a place in the first place. Anyone know how it is done? Also, is anyone using tomcat with Red Hat 9 and postgresql? I cannot seem to be able to start the postmaster with the -i flag (used to enable network connections, necessary for JDBC connections too apparently). Thanks, Neil - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]