Re: DBTags Taglib
If you are using a recent implementation of the Servlet specification, you should use Apache's implementation of the JSTL, not DBTags. DBTags has been inactive since development on JSTL began, and it should be considered deprecated for Servlet 2.3 or 2.4 containers. - Morgan Delagrange --- PAZDZIOREK,LUKASZ (HP-Poland,ex1) [EMAIL PROTECTED] wrote: Hi Everybody, I am trying to process web form and insert its values to the database using DBTags. This is what I am doing: %-- insert a row into the database --% sql:preparedStatement id=stmt1 conn=conn sql:query INSERT INTO CUSTOMER (CUST_PHONENO, CUST_NAME, CUST_SURNAME, CUST_TOWN, CUST_EMAIL, CUST_USERNAME, CUST_PASSWORD, CUST_WWW_REGISTERED_DATE, CUST_FK_CT_ID, CUST_FK_CS_ID) values (?,?,?,?,?,?,?,?,?,?) /sql:query sql:setColumn position=148%= CustomerBean.getPhone_no()%/sql:setColumn sql:setColumn position=2%= CustomerBean.getName()%/sql:setColumn sql:setColumn position=3%= CustomerBean.getSurname()%/sql:setColumn sql:setColumn position=4%= CustomerBean.getTown()%/sql:setColumn sql:setColumn position=5%= CustomerBean.getEmail()%/sql:setColumn sql:setColumn position=6%= CustomerBean.getLogin()%/sql:setColumn sql:setColumn position=7%= CustomerBean.getPasswd()%/sql:setColumn sql:setColumn position=8%= sqlDateTimeFormat_.format(Callendar_.getTime()) % /sql:setColumn sql:setColumn position=9WWW/sql:setColumn sql:setColumn position=10ACTIVE/sql:setColumn sql:execute/ /sql:preparedStatement I have one problem: 3 fileds in the formcould be emtand I would like to live these database fields set as NULL, How can I do it? Is it possible to insert NULL value using preparedStatement tag ? thank you for your help. regards, lukas - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] = Morgan Delagrange http://jakarta.apache.org/commons http://axion.tigris.org __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to test on not empty
--- Shawn Bayern [EMAIL PROTECTED] wrote: On Tue, 23 Apr 2002 [EMAIL PROTECTED] wrote: I was just wondering while reading the specification - how do I test on something being not empty? c:if test=${!empty param.name} You specified a name. /c:if Is this correct? Sure - or ${not empty param.name} or ${param.name != null} = Morgan Delagrange http://jakarta.apache.org/taglibs http://jakarta.apache.org/commons http://axion.tigris.org __ Do You Yahoo!? Yahoo! Games - play chess, backgammon, pool and more http://games.yahoo.com/ -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: getColumn
Yes, the to attribute of the getColumn tag writes to a Servlet attribute, not a scripting variable. A scripting variable would have been awkward because the to attribute is optional; by default the tag will simply write to the current writer. - Original Message - From: Carole E. Mah [EMAIL PROTECTED] To: Tag Libraries Users List [EMAIL PROTECTED] Sent: Tuesday, April 23, 2002 1:35 PM Subject: getColumn I don't understand how to use the to attribute. % String myValue = request.getParameter(bar); % sql:getColumn colName=blort to=myValue This is the sort of thing I want to do, I think. But it does not work, i.e. the string foo has a value bar and that ought to get written over by the value of colName blort but it does not. Basically what I want is to get each row value of the 'blort' column from my blah DBtable, and write that to an option value. In PHP, this would be: $query = SELECT farble, blort FROM blah; $my_result = mysql_db_query ($dbname, $query, $linkid); echo select name=\whatever\; while ($my_row =mysql_fetch_object($my_result)) { $myValue = $my_row-blort; echo option value=\$myValue\$myValue/option } echo /select; Clearly to writes somewhere other than a scriplet variable. ?? I am not very smart today. Thanks for any advice, -Carole - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Carole E. Mah [EMAIL PROTECTED] Senior Programmer/Analyst Brown University Scholarly Technology Group phn 401-863-2669 fax 401-863-9313 http://www.stg.brown.edu/ personal: http://www.stg.brown.edu/~carolem/ -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: DBTags
That limitation was just in anticipation of common usage. You should be able to loosen your TLD in that case (and most other cases) without affecting the application. - Original Message - From: Rau, Rajesh [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, January 21, 2002 12:11 PM Subject: DBTags Hi, allow me to thank you'll for all the wonderful time-saving tags you have created for us to use. I had one question tho': Why are you not allowing run-time evaluation for the getColumn tag ? I want to use this statement in a common function where I some same stuff with all the columns, but I am not allowed to use a variable since it is not defined for runtime evaluation. Is there a reason for doing this ..maybe because of database performance and stuff ? Or is there another tag I could use ? Just curious...thanks for your time taken to respond. Raj This message and any attachments are confidential to the intended recipient at the e-mail address to which it has been addressed. If you are not the intended recipient you may not copy, forward, disclose or use any part of this message or its attachments. If you received in error please notify the sender immediately by e-mail or contact The Innovation Group, US, at 800-669-9689 and then delete this message from your system. Neither the sender nor any office or company in The Innovation Group plc group will be liable for any viruses. Any opinions contained in this message are those of the author and are not given or endorsed by any company in The Innovation Group plc group through which this message was sent unless otherwise expressly stated in this message and the authority of the author in so stating is verified. The Innovation Group, US, at 8345 Lenexa Drive, Suite 100, Lenexa, Kansas, 66214, USA. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: dbTags
Another possibility is to store the primary key of the last accessed record in the session and use it when creating the sql query. P.Miller wrote on 11/15/01 3:00 am: Hi Dinesh, take a look at jsptags.com. (tld-info: The Pager Tag Library helps generate Google[sm] and AltaVista® style search result navigators. It will take multiple pages worth of information, dynamically split it up into page sized pieces and generate browsable index. It does this in a flexible way that allows designers to give the index just about any look desired) So you have a good example or use it as is. Hth Peter Dinesh, S. wrote: Hi all, I am developing a small application using dbTags. I would like to fetch 20 records per page at a time, and allow the user to click on a next and previous buttons, as well as the page number index, how can I go about this? At the moment, I have set the loop to false, and I iterate manually. However, if my SQL Select Statement returned 1000 records, to get to the last page, I would need to iterate through 980 records before displaying record 981 to 1000. Is there a better way to achieve this... using dbtags? I read somewhere in the dbTags documentation about fetchSize and maxRows, but I don't know how to use them. Can someone please kindly advice. Thanx, Dinesh, S. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Blob Support
How would you envision such functionality? Since JSPs are a text medium, we did not put a lot of thought into support for binary data. - Morgan Ricardo Rebouças wrote on 10/31/01 5:20 am: Hi there! I'm a brazilian dbtags's user. I found it just fantastic, it makes building a database driven jsp simple but robust. Unfortunately I'm missing Blob Field support. Is there any intention of yours on making it available? If yes when is it going to happen? If I develop something to solve this lack, how can I share with others, mainly with you, my code. Perhaps this new featurecould be released in next version Thanks in advance and congratulations! Ricardo Reboucas System Analyst [EMAIL PROTECTED] _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: RE: Query Caching
Stacy Young wrote on 9/29/01 9:48 pm: What you've just described does not really apply to my environment. I hardly implement any of the business logic, if any at all, in the front end...Unless it's a smaller application that I'm rolling out, then sure... Does this mean there aren't any DB Tags with caching functionality? ;-) Not yet. There is a JSR working on cacheable RowSet implementations, but I can't say when there will be a release of that effort or how exactly it would be implemented in DBTags. - Morgan _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com
Re: Taglibs under JDK 1.1
DBTags probably does not support JDK 1.1. We haven't made any explicit attempt to do so, and there are probably Java 2 collections at the least. - Original Message - From: Alexander Anderson [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, September 05, 2001 6:38 PM Subject: Taglibs under JDK 1.1 Greetings, May I ask if Taglibs, more specifically DBTags, has any dependencies on Java 2 features? I would like to know because I get NoClassDefFoundError when trying dbtags-examples. I am using Jakarta Tomcat 3.2.1 with JDK 1.1.8. By the way, here's the exact error message: #v+ Error: 500 Location: /dbtags-examples/jdbc.jsp Internal Servlet Error: javax.servlet.ServletException at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:399) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java: 404) at org.apache.tomcat.core.Handler.service(Handler.java:286) at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:37 2) at org.apache.tomcat.core.ContextManager.internalService(ContextManager .java:797) at org.apache.tomcat.core.ContextManager.service(ContextManager.java:74 3) at org.apache.tomcat.service.http.HttpConnectionHandler.processConnecti on(HttpConnectionHandler.java:210) at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java :416) at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.jav a:498) at java.lang.Thread.run(Thread.java) Root cause: java.lang.NoClassDefFoundError #v- _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com
Re: DB connection tag question
Why don't you just read the password from a context parameter? It's directly supported in the DBTags syntax: sql:password initParameter=your context parameter here/ - Original Message - From: Karen E. Lee [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, August 17, 2001 1:53 PM Subject: Re: DB connection tag question I am trying to write a little extension to the dbtags tablib which reads a password from a properties file instead of directly from the body of the jsp. At this point out of frustration I have simplified it down to: --- package edu.ufl.osg.dbtags.connection; import java.io.*; import java.util.*; import javax.naming.*; import javax.servlet.jsp.JspTagException; import javax.servlet.jsp.tagext.BodyTagSupport; import org.apache.taglibs.dbtags.connection.*; public class PropFileTag extends BodyTagSupport { public int doEndTag() throws JspTagException{ try { ConnectionTag connTag = (ConnectionTag) findAncestorWithClass(this, Class.forName(org.apache.taglibs.dbtags.connection.ConnectionTag)); connTag.setPassword(myPassword); } catch (Exception e) { e.printStackTrace(); } return EVAL_PAGE; } } This is still returning a null password exception: java.lang.IllegalArgumentException: null password with user:karenlee at com.ibm.ejs.cm.pool.ConnectionPool.allocateConnection(ConnectionPool.java:47 2) If I abandon my propfiletag and just use DBTags:password it works fine. Any idea what's going on? Thanks. -- Karen Lee Open Systems Group Northeast Regional Data Center University of Florida [EMAIL PROTECTED] _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com
Re: DB connection tag question
- Original Message - From: Karen E. Lee [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, August 16, 2001 1:26 PM Subject: DB connection tag question I am using DBTags in an app I'm working on... very simple, just one jsp page. I am confused about how to use a datasource to get the connection. In the API it says The connection tag also accepts a reference to a Servlet attribute containing a javax.sql.DataSource object. (The attribute is found via the findAttribute() method of PageContext.): I have used scriptlets to create a DataSource object from a JNDI named connection pool: % Hashtable params = new Hashtable(); % % params.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, com.ibm.ejs.ns.jndi.CNInitialContextFactory); % % Context ctx = new javax.naming.InitialContext(params); % % javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup(jdbc/mydatabase); % How do I now use this DataSource in my connection tag? Thanks. Then you have to assign it to a servlet attribute: % pageContext.setAttribute(ds1, ds); % and then reference that DataSource attibute in the connection tag: sql:connection id=conn1 dataSource=ds1/ or you could pass the jndiName in via the jndiName attribute to the connection tag, but I don't know too much about that. - Morgan _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com
Re: Dbtags DB connection in JSP
There's nothing intrinsic to the tags that does connection pooling, so you'll probably want to implement something. You might want to check out the DBCP component in the Jakarta Commons subproject. - Original Message - From: ranjit lingaiah [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, August 16, 2001 5:43 PM Subject: Dbtags DB connection in JSP I have a group of JSP pages that make up my application. I specify below DB information info in each of those pages. sql:connection id=schedules_list sql:url initParameter=dbUrl/ sql:driver initParameter=dbDriver/ sql:userId initParameter=dbUserId/ sql:password initParameter=dbPassword/ /sql:connection Question: Is this ok? or do I need to write a connection manager that does connection pooling? thanks, -ranjit _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com
Re: DBTags using resultSet tag with RowSets
OK I think I fixed it so that rowCount, wasEmpty, and wasNotEmpty will work outside of statements. Give it a try after tonight's build. :) Still not sure about the other problem you are having. Sounds like a container bug. - Morgan --- Halvorson, Loren [EMAIL PROTECTED] wrote: I'm using the brand new RowSet capability of the resultSet tag. According to the docs here: http://jakarta.apache.org/taglibs/doc/dbtags-doc/index.html#overview.tags.re sultset http://jakarta.apache.org/taglibs/doc/dbtags-doc/index.html#overview.tags.r esultset ...Note that when you read a ResultSet/RowSet from an attribute, the resultSet tag does not need to be inside of a statement tag. So my question is if the resultSet tag is not inside of a statement tag, is there _any_ way I can use these three handy tags? wasEmpty wasNotEmpty rowCount I'd love to use them, but of course they error out because they are not contained in a statement tag. = Morgan Delagrange http://jakarta.apache.org/taglibs http://jakarta.apache.org/commons __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/
RE: DBTags in WebLogic 6.0
--- Halvorson, Loren [EMAIL PROTECTED] wrote: Morgan, I decompiled the JSP servlet WebLogic created that contains the two ResultSet tags and tried to trace through it to see what WebLogic is doing wrong, but it wasn't immediately obvious to me. But something seems fishy. If the doStartTag() is returning SKIP_BODY, it still seems to be writing out the previously cached body in the doEndTag() (Am I reading this right?) Here's the snippet of the compiled JSP page that may be interesting. I condensed it by eliminating what I believe to be irrelevant lines of code. public void _jspService(...) { ResultSetTag resultsettag = null; if(resultsettag == null) resultsettag = new ResultSetTag(); j = resultsettag.doStartTag(); if(j == 1) throw new JspTagException(cannot return Tag.EVAL_BODY_INCLUDE); if(j != 0) --- ** SKIP_BODY is 0 { : --- *** iteration occurs here } if(resultsettag.doEndTag() == 5) { _releaseTags(resultsettag); return; } obj = resultsettag.getParent(); resultsettag.release(); : *** Then the whole thing repeats again if(resultsettag == null) resultsettag = new ResultSetTag(); int j2 = resultsettag.doStartTag(); if(j2 == 1) throw new JspTagException(cannot return Tag.EVAL_BODY_INCLUDE); if(j2 != 0) { : --- *** iteration occurs here } if(resultsettag.doEndTag() == 5) { _releaseTags(resultsettag); return; } resultsettag.release(); According to this post on the BEA newsgroup, release() is the place to clean up state. http://newsgroups.bea.com/cgi-bin/dnewsweb?cmd=articlegroup=weblogic.develo per.interest.jspitem=4710utag= According to my understanding, that's overkill. From my conversions with some of the JSR folks, release() seems to only be required at garbage collection time. However, in the case of DBTags, we do indeed reset state with release() and call it in most doEndTag() methods. Is there any harm in clearing the body in the reset() method? I'm not too familiar with the finer points of the Taglib specification. I suppose I can just get the source for DBTags and put the hack in myself just to keep us going, but I was hoping not to have to do that. The only harm is that it appears to be specifically addressing a bug in WLS, rather than something dictated by the spec. Believe me, I use WLS 6 in production too, so I know how frustrating WLS bugs can be. I think my preference would be to not add WLS-specific workarounds. It's pretty simple to add that code to your local CVS copy. If we find out that this is something required by the spec, I'll be happy to modify the source. Otherwise I advise hounding your WLS rep. :) Any insight you can give me is greatly appreciated. Thanks, --Loren -Original Message- From: Morgan Delagrange [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 14, 2001 5:26 PM To: [EMAIL PROTECTED] Subject: Re: DBTags in WebLogic 6.0 Ouch, really really sounds like a Weblogic bug to me. Even if the tags are being cached, there's no way that the tag should be retaining that information from invocation to invocation. In fact, when the result set is empty, we return the SKIP_BODY constant. :P - Morgan --- Halvorson, Loren [EMAIL PROTECTED] wrote: I have found what I think to be a problem with the DBTags ResultSet taglib when used with WebLogic 6.0 SP2. (I don't think it's significant, but I am using RowSets rather than ResultSets) I have a single JSP with two rowset tags, the first tag is fed a rowset with several rows in it and works flawlessly, but the second is fed a rowset who's query did not return any rows, and the body of the first tag is erroneously written out for the second. In ResultSetTag.java the body content seems to need to be cleared out somehow in release() due to WebLogic's recycling of the tag instances. I wondered if doing something like the following would fix it: public void release() { _statement = null; _rset = null; _shouldLoop = true; _name = null; _scope = null; _rowCount = 0; _stmtTag = null; try { getBodyContent().clear(); } catch (Exception e) { } } = Morgan Delagrange http://jakarta.apache.org/taglibs http://jakarta.apache.org/commons __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/ = Morgan Delagrange http://jakarta.apache.org/taglibs http://jakarta.apache.org/commons __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/
Re: DBtags question
--- ranjit lingaiah [EMAIL PROTECTED] wrote: I'm using Tomcat 3.2.3. colName attribute fails with 'date' type of fields in DB. As I said, getColumn works with position attribute for date type of fields, but fails when I use colName. sql:getColumn position=1 to=cur_date/// SUCCESSFULL sql:getColumn colName=cur_date to=cur_date/ // FAILS Are you saying I should look under getColumnNumber method in the source? You can if you want, although I don't think it will actually reveal anything useful. Since that method is so self-contained, and the exception appears to show that the correct column name is being passed in, it seems like the only likely problems are: 1) Somehow I'm pulling the wrong ResultSetMetaData object. It's possible, so I'll keep my eye on it. Does this page have more than one statement? It's possible that some info is being incorrectly cached, but I did not think that your version of Tomcat supported caching taglibs. I'll tack a release() call into the end tags just to make sure, and you can try the new build tomorrow. 2) A bug in your Oracle driver wrt. ResultSetMetaData and Date fields. It seems unlikely, but it's the only other possibility that jumps out at me. - Morgan = Morgan Delagrange http://jakarta.apache.org/taglibs http://jakarta.apache.org/commons __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/
Re: DBTags using resultSet tag with RowSets
Wow, excellent point. I hadn't even considered that contingency. Let me see if there's anything I can do. --- Halvorson, Loren [EMAIL PROTECTED] wrote: I'm using the brand new RowSet capability of the resultSet tag. According to the docs here: http://jakarta.apache.org/taglibs/doc/dbtags-doc/index.html#overview.tags.re sultset http://jakarta.apache.org/taglibs/doc/dbtags-doc/index.html#overview.tags.r esultset ...Note that when you read a ResultSet/RowSet from an attribute, the resultSet tag does not need to be inside of a statement tag. So my question is if the resultSet tag is not inside of a statement tag, is there _any_ way I can use these three handy tags? wasEmpty wasNotEmpty rowCount I'd love to use them, but of course they error out because they are not contained in a statement tag. = Morgan Delagrange http://jakarta.apache.org/taglibs http://jakarta.apache.org/commons __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/
Re: dbtags : preparedStatement in iplanet
Hmm, I don't see anythinq wrong with your syntax. I'm not sure what the problem would be. As for the missing TLD, that's just a temporary glitch. Today I plan to roll the DBTags build back to a previous version until I finish enhancing the new build to support DBTags. - Morgan [EMAIL PROTECTED] wrote on 7/25/01 9:55 am: I experienced a problem while using the execute tag within the preparedstatement tag in iplanet. I got the message : Incompatible type for method. Can't convert java.lang.String to int. _jspx_th_sql_setColumn_1.se tPosition(2); My JSP : sql:preparedStatement id=stmt1 conn=conn1 sql:query insert into news(ns_title, ns_summary) values (?,?) /sql:query sql:execute sql:setColumn position=1%= request.getParameter (title)%/sql:setColumn sql:setColumn position=2%= request.getParameter (summary)%/sql:setCol umn /sql:execute /sql:preparedStatement Does anybody have an idea ? Moreover I cannot found the new dbtags.tld in the distribution. How can I get it ? Thanks Benoit Borlee
RE: Most useful Tag library Poll
Interestingly, lately I've seen lots of developers come to the conclusion that EJBs (Entity and Session) are not appropriate for all (or even most) Enterprise tasks. I've seen several threads lately about companies that started out with pure EJB solutions and then scaled back to simple classes running inside the Servlet container and/or taglibs, resulting in significant performance boosts (I myself worked on such a project). Lots of companies start out under the assumption that all their business logic MUST be in an EJB, rather than a class or taglib. The reality is, EJBs are not always an efficient alternative. Remember EJBs create signficant Serialization overhead and, in the case of stateless beans, often lead to serious sacrifices in programming technique. Use the right tool for the right job. If you are performing the same credit card transactions over and over, then an EJB is probably the ticket. If, on the other hand, you're providing a view of some database rows to your JSP, you might want to avoid the Serialization overhead and use a tag library (like DBTags :). - Morgan On Thu, 5 Jul 2001, Lee Ball wrote: Hi While that I would agree that most web apps use a DB I'm not sure that the DB tags are that useful for an enterprise application as the DB access should be done through Data Access Objects or Entity Beans?? I have found the jakarta input tags very useful as well as the loop tags which are supplied with WebLogic. Cheers Lee -Original Message- From: mihai manuta [mailto:[EMAIL PROTECTED]] Sent: 05 July 2001 16:12 To: [EMAIL PROTECTED] Subject: RE: Most useful Tag library Poll Maybe the DBtaglib is the most used library. I mean... I cannot think of a Web application without DB access. Sincerely, Mihai Manuta [EMAIL PROTECTED] tel: +336.73.56.57.92
Re: DBTags and Memo fields
Ah, that's interesting. If memo fields don't return one of the standard JDBC constants, that might cause unpredictable behaviour. Let me take a look see and make sure that it will default to getColumn(). On Fri, 8 Jun 2001, Yiyi Sun wrote: As I said we cannot use DBTags with jdbc-odbc. I think that's a problem of the driver. jdbc-odbc bridge too. The getColumnType() returns -1 on my memo field. Yiyi Hmm, doesn't sounds quite right. The getColumn tag only uses the getClob() method for CLOB data types; in all other cases, it uses getString(). This sounds like a driver issue, but I can't be certain. On Tue, 5 Jun 2001, Yiyi Sun wrote: Hi Morgan, The memo type is very useful to store the large text. I used to use the getString(...) method of the Statement class to read memo fields while using the jdbc-odbc bridge and MS Access. I found in the source that the GetColumnTag class uses JDBC 2.0's Clob class . In JDK1.3 and beofore, the jdbc-odbc bridge is only JDBC 1.1. In JDK1.4 the bridge will be JDBC 2.0 that could support Clob. Until the finaly release of JDK1.4 in Q4 of this year, it seems that we cannot use DBTags with jdbc-odbc. Is it right? Cheers! Yiyi I've never heard of the memo type. Have you successfully accessed memo fields with JDBC drivers? If so, how did you do it? It's possible that memo fields are not supported by your JDBC drivers. On Sat, 2 Jun 2001, Yiyi Sun wrote: Hi All, When I am using DBTags with jdbc:odbc and MS Access database, the sql:getColumn ... / Tag raises java.sql.SQLException if the fields to be read are of memo type. Any workaround or suggestion? Thanks Yiyi
Re: DBTags and Memo fields
Hmm, doesn't sounds quite right. The getColumn tag only uses the getClob() method for CLOB data types; in all other cases, it uses getString(). This sounds like a driver issue, but I can't be certain. On Tue, 5 Jun 2001, Yiyi Sun wrote: Hi Morgan, The memo type is very useful to store the large text. I used to use the getString(...) method of the Statement class to read memo fields while using the jdbc-odbc bridge and MS Access. I found in the source that the GetColumnTag class uses JDBC 2.0's Clob class . In JDK1.3 and beofore, the jdbc-odbc bridge is only JDBC 1.1. In JDK1.4 the bridge will be JDBC 2.0 that could support Clob. Until the finaly release of JDK1.4 in Q4 of this year, it seems that we cannot use DBTags with jdbc-odbc. Is it right? Cheers! Yiyi I've never heard of the memo type. Have you successfully accessed memo fields with JDBC drivers? If so, how did you do it? It's possible that memo fields are not supported by your JDBC drivers. On Sat, 2 Jun 2001, Yiyi Sun wrote: Hi All, When I am using DBTags with jdbc:odbc and MS Access database, the sql:getColumn ... / Tag raises java.sql.SQLException if the fields to be read are of memo type. Any workaround or suggestion? Thanks Yiyi
Re: Proposal: DBTags and RowSet
Hi Bill, I sent you a couple of emails on this topic. - Morgan On Wed, 16 May 2001, Bill Pfeiffer wrote: Reposting my proposal for change to DBTAGS: BACKGROUND: For my current project, I have reworked the DBTags ResultSet tags (and nested tags) to pull a javax.sql.RowSet out of a specified scope attribute and make the RowSet data available. This modification removes the statement.execute() call and allows me populate the RowSet in another tier (EJB). My RowSet tag iterates just like the ResultSet tag and makes its data available to nested tags in the same manner as ResultSet. After reviewing what I did, I thought it would make more sense for the DBTags to support this, rather than do the rewrite that I did. PROPOSAL: I'd like to put forward the question to both the dev and user mailing lists: Does it make sense / would it be useful for the DBTags to have the option of pulling a ResultSet object from some specified scope, as an alternative to performing a statment.execute() to obtain a ResultSet? Note that the object stored in the specified scope COULD be a RowSet as RowSet implements ResultSet. BENEFIT(S): The major benefit of this approach would be the seperation of data retrieval (business logic) from data presentation. What do you think? Bill Pfeiffer
Re: Proposal: DBTags and RowSet
Hey Bill, I have to admit, I'm not too up on RowSets. I have a general idea what they're supposed to do, specifically in terms of portability around the environment, but I don't know them intimately. Do you have any ideas about how specifically you might alter the API? That might ground your ideas a bit for me. On Tue, 15 May 2001, Bill Pfeiffer wrote: BACKGROUND: For my current project, I have reworked the DBTags ResultSet tags (and nested tags) to pull a javax.sql.RowSet out of a specified scope attribute and make the RowSet data available. This modification removes the statement.execute() call and allows me populate the RowSet in another tier (EJB). My RowSet tag iterates just like the ResultSet tag and makes its data available to nested tags in the same manner as ResultSet. After reviewing what I did, I thought it would make more sense for the DBTags to support this, rather than do the rewrite that I did. PROPOSAL: I'd like to put forward the question to both the dev and user mailing lists: Does it make sense / would it be useful for the DBTags to have the option of pulling a ResultSet object from some specified scope, as an alternative to performing a statment.execute() to obtain a ResultSet? Note that the object stored in the specified scope COULD be a RowSet as RowSet implements ResultSet. BENEFIT(S): The major benefit of this approach would be the seperation of data retrieval (business logic) from data presentation. What do you think? Bill Pfeiffer
Re: JDBC Statement tag: connection scope
On Wed, 2 May 2001, Brent Johnson wrote: The statement tag gets its connection as follows inside of doStartTag(): Connection conn = (Connection)pageContext.getAttribute(_connId); This means that the connection must be defined at PAGE_SCOPE. This seems a bit restrictive. What if my connection isn't at page scope? Is there a reason why the statement tag doesn't use pageContext.findAttribute()? The sql:connection tags doesn't support assigning to another scope, so that's the only real logic there. I suppose it could use findAttribute, but I don't really dig on people storing Connections at other scopes. That's what database pools are for. :) - Morgan
Re: exposing script variables
(Pierre sent a related response as I was typing this, but I think it's still helpful.) Ah, OK, I think I see what you're asking for now. Often when people talk about scripting variables, they're just talking about assigning attributes, but you want the real deal. OK, time to introduce you to the glories of TagExtraInfo, a very nifty but slightly magical detail of the Servlet spec. You'll need to write a javax.servlet.jsp.tagext.TagExtraInfo class that describes the name of your scripting variable, what type of object it contains, and its scope on the page. In your case, if you just want to assign it's probably something like this: public class DefineTEI extends TagExtraInfo { public final VariableInfo[] getVariableInfo(TagData data) { return new VariableInfo[] { new VariableInfo( data.getAttributeString(id), Object, true, VariableInfo.AT_END ), }; } } See that VariableInfo object that I defined? The first part retrieves the value of the id attribute, so that the container knows how to create the scripting variable. The second part indicates what type of Object your scipting variable will contain (in your case, java.lang.Object). The third part is true (just ignore it). And the fourth part tells the servlet container where to make the scripting variable available. You probably want AT_END, meaning after the end tag of your custom tags. The other options are AT_BEGIN (after the begin tag) and NESTED (only between the begin and end tags). Then, you have to go to your TLD file and indicate that this class is the extra info for your tag, something like this: tag namedefine/name tagclasspackage.classname/tagclass teiclasspackage.DefineTEI/teiclass bodycontentempty/bodycontent attribute nameid/name requiredtrue/required rtexprvaluefalse/rtexprvalue /attribute attribute namescope/name requiredfalse/required rtexprvaluefalse/rtexprvalue /attribute /tag If you do this, then the following tag: itl:define id=organizationsBean scope=session/ should take your attribute and assign it as a scripting variable (using the logic of findAttribute(String), I believe), so you can treat it as if it we're already defined on the page: % String organizationId = ((OrganizationsBean) organizationsBean).getColumn(ORGANIZATIONID); % Is this what you're looking for? - Morgan
Re: simple select problem
Take out this line: jsp:getProperty name="conn1" property="userId"/ You are attempting to access a property of java.sql.Connection that does not exist. - Morgan On Fri, 20 Apr 2001, Aron Kramlik wrote: In that file, line 215 is: out.print(JspRuntimeLibrary.toString(JspRuntimeLibrary.handleGetProperty(pageContext.findAttribute("conn1"), "userId"))); WhichI guess means that: pageContext.findAttribute("conn1") is evaluated to be null. I am not sure why this is the case since I have the connection tag in there and that does not seem to complain. Am I missing something really simple? Aron. Christopher Widhelm wrote: Go and look at this file, _summary_5F_sport_jsp_1.java, in your work directory at line 215 and see which object it says is null and then add a check to your jsp to see if the object is null before you perform the operation. -Original Message- From: Aron Kramlik [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 19, 2001 2:06 AM To: [EMAIL PROTECTED] Subject: simple select problem Hi, I just downloaded the JDBC binary distribution (20010410). I have created a very simple JSP that tries to access a table. I am running on IBM WebSpere (linux) ad Sybase database. The JSP is as follows and the exception I get follows that. If anyone has any ideas I would be very greatful as I am sure this is some simple problem. Thanks, Aron. --- JSP --- html head titleUntitled Document/title /head %@ taglib uri="http://jakarta.apache.org/taglibs/jdbc" prefix="sql" % sql:connection id="conn1" sql:urljdbc:sybase:Tds:lindev3:4100/sql:url sql:drivercom.sybase.jdbc2.jdbc.SybDriver/sql:driver sql:userIduser/sql:userid sql:passwordpwd/sql:password /sql:connection jsp:getProperty name="conn1" property="userId"/ table sql:statement id="stmt1" conn="conn1" sql:query select id, name from category1 /sql:query sql:resultSet id="rset2" tr tdsql:getColumn position="1"//td tdsql:getColumn position="2"//td /tr /sql:resultSet /sql:statement /table sql:closeConnection conn="conn1"/ /body /html -- exception -- org.apache.jasper.JasperException: Attempted a bean operation on a null object. at javax.servlet.ServletException.init(ServletException.java:107) at org.apache.jasper.JasperException.init(JasperException.java:73) at org.apache.jasper.runtime.JspRuntimeLibrary.handleGetProperty(JspRuntimeLibr ary.java:427) at alerts._summary_5F_sport_jsp_1._jspService(_summary_5F_sport_jsp_1.java:215) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:127) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.ja va:381) at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:702) at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:822) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at com.ibm.servlet.engine.webapp.StrictServletInstance.doService(ServletManager .java:626) at com.ibm.servlet.engine.webapp.StrictLifecycleServlet._service(StrictLifecycl eServlet.java:160) at com.ibm.servlet.engine.webapp.IdleServletState.service(StrictLifecycleServle t.java:287) at com.ibm.servlet.engine.webapp.StrictLifecycleServlet.service(StrictLifecycle Servlet.java:105) at com.ibm.servlet.engine.webapp.ServletInstance.service(ServletManager.java:36 0) at com.ibm.servlet.engine.webapp.ValidServletReferenceState.dispatch(ServletMan ager.java:775) at com.ibm.servlet.engine.webapp.ServletInstanceReference.dispatch(ServletManag er.java:701) at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.handleWebAppDispatch(W ebAppRequestDispatcher.java:404) at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.dispatch(WebAppRequest Dispatcher.java:203) at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.forward(WebAppRequestD ispatcher.java:107) at com.ibm.servlet.engine.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker. java:77) at com.ibm.servlet.engine.invocation.CachedInvocation.handleInvocation(CachedIn vocation.java:67) at com.ibm.servlet.engine.srp.ServletRequestProcessor.dispatchByURI(ServletRequ estProcessor.java:155) at com.ibm.servlet.engine.oselistener.OSEListenerDispatcher.service(OSEListener .java:300) at com.ibm.servlet.engine.oselistener.SQEventListenerImp$ServiceRunnable.run(SQ EventListenerImp.java:230) at com.ibm.servlet.engine.oselistener.SQEventListenerImp.notifySQEvent(SQEventL istenerImp.java:104) at
Re: 'No suitable driver' exception
There's a typo in your sample JSP. Is this really what your source looks like? sql:driver initParameer="dbDriver"/ It should be "initParameter", but your servlet engine should also be giving you some sort of warning. On Thu, 19 Apr 2001, Procek, Brett wrote: Hello, Has anyone gotten the 'initParameter' functionality working using the JDBC custom library tags. I set up the appropriate Context variables in my web.xml file, but I keep getting the same exception = 'No suitable driver'. I can successfully connect to my Oracle database if I put the URL/driver information directly in the JSP page. It anyone can help, this would be much appreciated. Thanks, Brett Here are the relavant code snippets... Tagged Database connection attempt in my.JSP File -- sql:connection id="conn1" sql:url initParameter="dbURL"/ sql:driver initParameer="dbDriver"/ /sql:connection - Web.XML file context-param param-namedbURL/param-name param-valuejdbc:oracle:thin:[EMAIL PROTECTED]:1521:NM S/param-value /context-param context-param param-namedbDriver/param-name param-valueoracle.jdbc.driver.OracleDriver/param-value /context-param --
Re: AW: Newbie Question
Yup, that's the real problem. Sorry. --- Stefan Riegel [EMAIL PROTECTED] wrote: Hello Morgan, hello Amar, isn't their another error in the code of Amar? If I understood the thing right (I am newbie too), the "taglib-uri-Tag" defines a sort of placeholder for the real location, which is defined in the "taglib-location-Tag". Amar wrote taglib-urihttp://***java***.apache.org/taglibs/jdbc/taglib-uri but refers to ***jakarta***.apache.org/taglibs/jdbc in the JSP-Page. The JSP Container doesn't find the specified URI in the web.xml and takes the URI itself (http://jakarta.apache...) as the default location for the tag library descriptor file. Because their isn't the TLD, the container produces the error. I think it is less complicated, if one uses the default location like %@ taglib uri="/WEB-INF/jdbc.tld" prefix="sql" % for learning or testing purpose. I use some Jakarta Taglibs without any taglib-Entry in the web.xml. Regards Stefan Riegel -Ursprungliche Nachricht- Von: Morgan Delagrange [mailto:[EMAIL PROTECTED]] Gesendet: Donnerstag, 12. April 2001 21:17 An: [EMAIL PROTECTED] Betreff: Re: Newbie Question I would think that would work, but you might want to try this in your web.xml instead: taglib taglib-urihttp://java.apache.org/taglibs/jdbc/taglib-uri taglib-locationjdbc.tld/taglib-location /taglib Also, as a point of information, this line shouldn't be necessary if you only access the database via the tag library: %@ page language="java" import="java.sql.*, oracle.jdbc.driver.*" % --- Dummy Amar [EMAIL PROTECTED] wrote: Hi, I downloaded the JDBC taglib directory and following the direction copied the jdbc.tld file under the /WEB-INF directory and jdbc.jar under /WEB-INF/lib directory. I also created an entry in the /WEB_INF/web.xml like taglib taglib-uri http://java.apache.org/taglibs/jdbc/taglib-uri taglib-location/WEB-INF/jdbc.tld/taglib-location /taglib After that I tried the following JSP page %@ page language="java" import="java.sql.*, oracle.jdbc.driver.*" % %@ taglib uri="http://jakarta.apache.org/taglibs/jdbc" prefix="sql" % %-- open a database connection --% sql:connection id="conn1" sql:urljdbc:oracle:thin:@oak.stgeorgeconsulting.com:1521:ser verName/sql:url sql:driveroracle.jdbc.driver.OracleDriver/sql:driver %-- optional --% sql:userIdUsernmae/sql:userId %-- optional --% sql:passwordpassword/sql:password /sql:connection %-- close a database connection --% sql:closeConnection conn="conn1"/ I am receiving the following error message org.apache.jasper.JasperException: Unable to open taglibrary http://jakarta.apache.org/taglibs/jdbc : Could not locate TLD META-INF/taglib.tld at org.apache.jasper.compiler.JspParseEventListener.handleDirecti ve(JspParseEventListener.java:672) at org.apache.jasper.compiler.DelegatingListener.handleDirective( DelegatingListener.java:116) at org.apache.jasper.compiler.Parser$Directive.accept(Parser.java:215) at org.apache.jasper.compiler.Parser.parse(Parser.java:1073) at org.apache.jasper.compiler.Parser.parse(Parser.java:1038) at org.apache.jasper.compiler.Parser.parse(Parser.java:1034) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:182) at org.apache.jasper.runtime.JspServlet.loadJSP(JspServlet.java:413) at org.apache.jasper.runtime.JspServlet$JspServletWrapper.loadIfN ecessary(JspServlet.java:149) at org.apache.jasper.runtime.JspServlet$JspServletWrapper.service (JspServlet.java:161) at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet .java:261) at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:369) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWra pper.java:503) at org.apache.tomcat.core.ContextManager.service(ContextManager.java:559) at org.apache.tomcat.service.http.HttpConnectionHandler.processCo nnection(HttpConnectionHandler.java:160) at org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEnd point.java:338) at java.lang.Thread.run(Thread.java:484) Please help. Thanks in advance Amar Das = Morgan Delagrange Britannica.com ______ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/ = Morgan Delagrange Britannica.com __ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/
Re: Newbie Question
I would think that would work, but you might want to try this in your web.xml instead: taglib taglib-urihttp://java.apache.org/taglibs/jdbc/taglib-uri taglib-locationjdbc.tld/taglib-location /taglib Also, as a point of information, this line shouldn't be necessary if you only access the database via the tag library: %@ page language="java" import="java.sql.*, oracle.jdbc.driver.*" % --- Dummy Amar [EMAIL PROTECTED] wrote: Hi, I downloaded the JDBC taglib directory and following the direction copied the jdbc.tld file under the /WEB-INF directory and jdbc.jar under /WEB-INF/lib directory. I also created an entry in the /WEB_INF/web.xml like taglib taglib-uri http://java.apache.org/taglibs/jdbc/taglib-uri taglib-location/WEB-INF/jdbc.tld/taglib-location /taglib After that I tried the following JSP page %@ page language="java" import="java.sql.*, oracle.jdbc.driver.*" % %@ taglib uri="http://jakarta.apache.org/taglibs/jdbc" prefix="sql" % %-- open a database connection --% sql:connection id="conn1" sql:urljdbc:oracle:thin:@oak.stgeorgeconsulting.com:1521:serverName/sql:url sql:driveroracle.jdbc.driver.OracleDriver/sql:driver %-- optional --% sql:userIdUsernmae/sql:userId %-- optional --% sql:passwordpassword/sql:password /sql:connection %-- close a database connection --% sql:closeConnection conn="conn1"/ I am receiving the following error message org.apache.jasper.JasperException: Unable to open taglibrary http://jakarta.apache.org/taglibs/jdbc : Could not locate TLD META-INF/taglib.tld at org.apache.jasper.compiler.JspParseEventListener.handleDirective(JspParseEventListener.java:672) at org.apache.jasper.compiler.DelegatingListener.handleDirective(DelegatingListener.java:116) at org.apache.jasper.compiler.Parser$Directive.accept(Parser.java:215) at org.apache.jasper.compiler.Parser.parse(Parser.java:1073) at org.apache.jasper.compiler.Parser.parse(Parser.java:1038) at org.apache.jasper.compiler.Parser.parse(Parser.java:1034) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:182) at org.apache.jasper.runtime.JspServlet.loadJSP(JspServlet.java:413) at org.apache.jasper.runtime.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:149) at org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:161) at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:261) at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:369) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503) at org.apache.tomcat.core.ContextManager.service(ContextManager.java:559) at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:160) at org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338) at java.lang.Thread.run(Thread.java:484) Please help. Thanks in advance Amar Das = Morgan Delagrange Britannica.com __ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/
Re: Dealing with NULL result columns
Sure, what I do is assign the column to a variable and then use the wasNull/wasNotNull tags. Something like: td sql:getColumn position="2" to="PO"/ sql:wasNotNull a href="PO.xtp?PO=%= pageContext.getAttribute("PO") %" %= pageContext.getAttribute("PO") % /a /sql:wasNotNull sql:wasNullnbsp;/sql:wasNull /td --- Steve Philp [EMAIL PROTECTED] wrote: I'm hoping someone can point out a way to work around a problem I'm experiencing. My code currently looks like the following: td a href="PO.xtp?PO=sql:getColumn position=2/" sql:getColumn position="2"/ /a /td How can I gracefully deal with a NULL value being returned? In the case of NULL, I'd like to forgo the a href and replace it with 'nbsp;'. Thanks for any help you can provide! I'm happy to provide more information/detail if needed. -- Steve Philp, MCSE/MCP+I Assistant IS Manager Advance Packaging Corporation [EMAIL PROTECTED] = Morgan Delagrange Britannica.com __ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/
Re: jdbc taglib problem
Hi, Warner, I'm glad you worked out your issue. By the way, that execute tag shouldn't be necessary for looping through the result set. Removing it should produce the same result. - Morgan --- Warner Onstine [EMAIL PROTECTED] wrote: Uh, never mind I found the problem (an unclosed comment tag), although a little baffled why a different error wasn't thrown, as I had this problem earlier and it pointed out the other spots to me. Oh well... -warner - Original Message - From: "Warner Onstine" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, April 03, 2001 6:33 PM Subject: Re: jdbc taglib problem To clarify it appears to be dying at this line: try { Connection conn = (Connection)pageContext.getAttribute(_connId); _statement = conn.createStatement(); pageContext.setAttribute(getId(), _statement); } catch (SQLException e) { throw new JspTagException(e.toString()); } where _statement = conn.createStatement() is called. -warner - Original Message - From: "Warner Onstine" [EMAIL PROTECTED] To: "taglibs-user" [EMAIL PROTECTED] Sent: Tuesday, April 03, 2001 5:07 PM Subject: jdbc taglib problem Hi all, I am having a problem using the jdbc taglib. After following the docuemntation I am still receiving this error: -- Root Cause: java.lang.NullPointerException at org.apache.taglibs.jdbc.statement.StatementImplTag.doStartTag(StatementImplT ag.java:137) at org.apache.jsp.genre_jsp._jspService(genre_jsp.java:70) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107) - When trying to connect with my database using this .jsp %-- open a database query -- sql:connection id="conn1" sql:urljdbc:mysql://64.165.39.221/reviews/sql:url sql:driverorg.gjt.mm.mysql.Driver/sql:driver sql:userId**/sql:userId (note not actually stars!) sql:password**/sql:password (note not actually stars!) /sql:connection %-- open a database query --% table sql:statement id="stmt1" conn="conn1" sql:query select * from tbl_moviegenre /sql:query %-- loop through the rows of the query sql:resultSet id="rset" tr tdPrimary key :: sql:getColumn position="1"//td tdGenre :: sql:getColumn position="2"//td /tr /sql:resultSet --% sql:execute ignoreErrors="true"/ /sql:statement /table sql:closeConnection conn="conn1"/ -- Now this works fine in a servlet with the same url, user, password. So I know it isn't my setup. Any ideas? This has been driving me nuts for the past 2 hours. Thanks in advance! -warner = Morgan Delagrange Britannica.com __ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/
Re: JDBC-TagLib with JDBC-ODBC-Bridge?!
Hmm, that's odd. My guess would be that, by default, your connections are being initialized as read-only (although that is unusual). Try placing this tag between your connection tags and your prepared statement tags: %-- make the connection writable --% jsp:setProperty name="conn" property="readOnly" value="false"/ Let me know if that makes a difference. - Morgan --- "Weßling,_Achim" [EMAIL PROTECTED] wrote: Hallo, does someone use the JDBC-TagLib with the JDBC-ODBC-Bridge to Access? I try inserting something and it doesn't work. Here is my code: %-- Open Database Connection --% jdbc:connection id="conn" jdbc:urljdbc:odbc:user/jdbc:url jdbc:driversun.jdbc.odbc.JdbcOdbcDriver/jdbc:driver /jdbc:connection %-- Open Database --% jdbc:preparedStatement id="stmt" conn="conn" jdbc:query INSERT INTO test (Wert1, Wert2) values (?, ?) /jdbc:query jdbc:execute jdbc:setColumn position="1"hier/jdbc:setColumn jdbc:setColumn position="2"Achim/jdbc:setColumn /jdbc:execute /jdbc:preparedStatement /jdbc:equals %-- close Database Connection --% jdbc:closeConnection conn="conn"/ brIt has to be done! I get the following error: Error: 500 Location: /TagLib/testing.jsp Internal Servlet Error: javax.servlet.ServletException: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query. at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp l.java:459) at _0002ftesting_0002ejsptesting_jsp_2._jspService(_0002ftesting_0002ejsptestin g_jsp_2.java:404) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja va:177) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404) at org.apache.tomcat.core.Handler.service(Handler.java:286) at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372) at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79 7) at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743) at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC onnectionHandler.java:210) at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416) at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498) at java.lang.Thread.run(Thread.java:484) Root cause: javax.servlet.jsp.JspTagException: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query. at de.infokomGT.taglib.jdbc.statement.ExecuteTag.doEndTag(ExecuteTag.java:119) at _0002ftesting_0002ejsptesting_jsp_2._jspService(_0002ftesting_0002ejsptestin g_jsp_2.java:347) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja va:177) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404) at org.apache.tomcat.core.Handler.service(Handler.java:286) at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372) at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79 7) at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743) at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC onnectionHandler.java:210) at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416) at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498) at java.lang.Thread.run(Thread.java:484) I didn't know what 'Operation must use an updateable query' means. Could someone help? Mit freundlichem Gruß Achim Weßling ** INFOKOM Gütersloh Fachbereich Technische Anwendungen / Zentrale Anwendungen Tel.: 05241/85-2926 [EMAIL PROTECTED] http://www.infokom-gt.de/produkte/gis/index.htm _\|/_ (o o) ---oOO-{_}-OOo--- = Morgan Delagrange Britannica.com __ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/?.refer=text
Re: SCOPE:attribute didn't work!?
Hi Achim, Are you using the "scopes" tag library in CVS? That is not currently an active project. Glenn should check something in next week that supercedes scopes. - Morgan --- "Weßling,_Achim" [EMAIL PROTECTED] wrote: Hallo, I try the following: jdbc:resultSet id="rs1" jdbc:wasNotEmpty scope:setAttribute name="sqlCount"jdbc:rowCount//scope:setAttribute scope:setAttribute name="UserID"jdbc:getColumn position="1"//scope:setAttribute scope:equals match="1" attribute="sqlCount" %-- START: Hier Code einfügen für gelungenen LOGIN --% brUserID: scope:attribute name="UserID"/ scope:exists attribute="UserID"brUserID existiert!/scope:exists brHost: %= request.getHeader("Host") % brTime: infokomGT:timedate format="time"/ brDate: infokomGT:timedate format="date"/ I set the attributes 'sqlCount' and 'UserID'. Later I want to output 'UserID', but scope:attribute name="UserID"/ didn't work, where for the equals-Tag and the exists-Tag work! Where is my mistake? I also looked at the source, but didn't find a mistake inside?! A little hint would be nice! Thanks a lot! Achim Weßling ** INFOKOM Gütersloh Fachbereich Technische Anwendungen / Zentrale Anwendungen Tel.: 05241/85-2926 [EMAIL PROTECTED] http://www.infokom-gt.de/produkte/gis/index.htm _\|/_ (o o) ---oOO-{_}-OOo--- = Morgan Delagrange Britannica.com __ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/?.refer=text
Re: Newbie problems with JDBC taglib
ned out since my download. Good catch. I introduced an error when I changed the capitalization of the jndiName attribute. It should work after tonight's build, or feel free to build it from source. Thanks for any help you can provide! -- Steve Philp, MCSE/MCP+I Assistant IS Manager Advance Packaging Corporation [EMAIL PROTECTED] = Morgan Delagrange Britannica.com __ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/
Re: Newbie problems with JDBC taglib
--- Morgan Delagrange [EMAIL PROTECTED] wrote: --- Steve Philp [EMAIL PROTECTED] wrote: [snip] When I execute that page under Resin 1.2.1 (IBM JDK 1.3 on Linux) I get the following error: java.lang.NoSuchMethodError: javax.servlet.jsp.tagext.TagData: method getAttributes()Ljava/util/Enumeration; not found [snip] What am I doing wrong? I'm not familiar with Resin, but it looks like your JSP engine is missing a feature. If you look at the Javadocs for Resin: http://www.caucho.com/products/resin/javadoc/javax/servlet/jsp/tagext/TagData.html it is missing the getAttributes() method proscribed by the Servlet 2.2 API: http://java.sun.com/products/servlet/2.2/javadoc/javax/servlet/jsp/tagext/TagData.html Solution: if you're familiar enough with Servlets and tag libraries, you could download the current CVS, remove the isValid() method from the BaseGetterTEI class, and build your own version of the tag. Just keep an eye on your usage, since that method performs valuable validation of the "colName" and "position" attributes of the getter tags. [snip] Strike that solution! I changed the source for the tag library to use the "getAttribute(String)" method instead, which seems to be supported by Resin. Now you should be able to use the getter tags from tonight's nightly build. Please note, however, that if Resin does not support the full Servlet 2.2 API, you may run into more problems with this and other Jakarta tag libraries. - Morgan = Morgan Delagrange Britannica.com __ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/
[ANNOUNCE] JDBC tag library released
Taglibs is proud to announce the release of the JDBC tag library! For full details, visit the site: http://jakarta.apache.org/taglibs/doc/jdbc-doc/intro.html The JDBC tag library is designed for reading from and writing to databases. Features include: - Seamless support for multiple databases - Obtaining connections from Drivers, DataSources, and JNDI DataSources - Support for Statements and PreparedStatements - Automatic looping of ResultSets - And so much more! Thanks to Rich Catlett, Glenn Nielsen, and most especially Marius Scurtescu for their invaluable contributions. - Morgan Delagrange __ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/
[ANNOUNCE] JDBC tag library released
Taglibs is proud to announce the release of the JDBC tag library! For full details, visit the site: http://jakarta.apache.org/taglibs/doc/jdbc-doc/intro.html The JDBC tag library is designed for reading from and writing to databases. Features include: - Seamless support for multiple databases - Obtaining connections from Drivers, DataSources, and JNDI DataSources - Support for Statements and PreparedStatements - Automatic looping of ResultSets - And so much more! Thanks to Rich Catlett, Glenn Nielsen, and most especially Marius Scurtescu for their invaluable contributions. - Morgan Delagrange __ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/
Re: Have you tried JDBC tag library with JDBC-ODBC bridge
Hmm, I wasn't aware that it was ever available as a binary download. JDBC has not been released yet, and currently it's only available by downloading and building the CVS repository. --- Daljeet Singh [EMAIL PROTECTED] wrote: Hello, Where can I find the latest JDBC tag library. It seems to have been removed from the zip files and also from the taglibrary home page. Thanx Daljeet Singh ecExperts India Ph:- (O) +91-11-5715330/5714420 (R) +91-11-7125680 ICQ:- 75129600 Yahoo:- daljeetsinghmaken = Morgan Delagrange Britannica.com __ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/
Re: Have you tried JDBC tag library with JDBC-ODBC bridge
Forward your exception to the list, maybe we can find the problem. Have you updated from CVS recently? There was a known UnsupportedOperation (isBeforeFirst()) that we factored out specifically to support SqlServer. - Morgan --- Daljeet [EMAIL PROTECTED] wrote: Hello Has anybody tried the JDBC tag library with JDBC-ODBC bridge to connect to MS Sql Server. I am using it on Tomcat 3.2 and keep getting UnsupportedOperationException. Does anybody know of a free JDBC driver for MS SqlServer 7.0 Thanx Daljeet Singh ecExperts India Ph:- (O) +91-11-5715330/5714420 (R) +91-11-7125680 ICQ:- 75129600 Yahoo:- daljeetsinghmaken = Morgan Delagrange Britannica.com __ Do You Yahoo!? Yahoo! Auctions - Buy the things you want at great prices! http://auctions.yahoo.com/
Re: Have you tried JDBC tag library with JDBC-ODBC bridge
I think we're close. We tried to vote on a release candidate this week, but new JNDI support was proposed and will probably be implemented. --- Maya Muchnik [EMAIL PROTECTED] wrote: Was JDBC tag released? Daljeet wrote: Hello Has anybody tried the JDBC tag library with JDBC-ODBC bridge to connect to MS Sql Server. I am using it on Tomcat 3.2 and keep getting UnsupportedOperationException. Does anybody know of a free JDBC driver for MS SqlServer 7.0 Thanx Daljeet Singh ecExperts India Ph:- (O) +91-11-5715330/5714420 (R) +91-11-7125680 ICQ:- 75129600 Yahoo:- daljeetsinghmaken = Morgan Delagrange Britannica.com __ Do You Yahoo!? Yahoo! Auctions - Buy the things you want at great prices! http://auctions.yahoo.com/