Bug 1032 - JDBC Taglib: escapeSql tag appears to add tick instead of escape character
Summary: JDBC Taglib: escapeSql tag appears to add tick instead of escape character
Status: RESOLVED LATER
Alias: None
Product: Taglibs
Classification: Unclassified
Component: DBTags Taglib (show other bugs)
Version: unspecified
Hardware: Other other
: P1 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-03-19 15:07 UTC by Garrel Renick
Modified: 2004-11-16 19:05 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Garrel Renick 2001-03-19 15:07:19 UTC
Note: Bugzilla requires that I select a Component for this report, but JDBC 
isn't included in the list of taglib components.

Setup:
Tomcat 3.2.1 on Windows NT
InstantDB with RmiJDBC driver SQL database
jdbc-examples.war from March 19, 2001 build
test_books table with same name and initial data indicated by author's script

Symptoms:
An SQLException occurs when I run the example in jdbc-examples.war. The stack 
trace indicates that there is an SQLException when the JSP attempts to insert a 
record with values that are between an escapeSQL tag pair. It seems to be trying 
to insert a record with a value that contains two tick marks (Gravity''s 
Rainbow) instead of using the typical "\" SQL escape character. If I modify 
jdbc.jsp by removing the escapeSQL tag pair and adding a "\" in front of the 
tick mark, the example works fine.

Here's the stack trace that I see:

Error: 500

Location: /jdbc-examples/jdbc.jsp

Internal Servlet Error:

javax.servlet.ServletException: java.sql.SQLException: insert into test_books 
(id, name) 
      values (3, 'Gravity''s Rainbow')
 Don't understand SQL after: "insert"
 Expected: "}" found: "s Rainbow"
        at 
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.ja
va:459)
        at 
_0002fjdbc_0002ejspjdbc_jsp_0._jspService(_0002fjdbc_0002ejspjdbc_jsp_0.java:245
0)
        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.java:1
77)
        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:797)
        at 
org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
        at 
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConne
ctionHandler.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: insert into test_books 
(id, name) 
      values (3, 'Gravity''s Rainbow')
 Don't understand SQL after: "insert"
 Expected: "}" found: "s Rainbow"
        at 
org.apache.taglibs.jdbc.statement.ExecuteTag.doEndTag(ExecuteTag.java:111)
        at 
_0002fjdbc_0002ejspjdbc_jsp_0._jspService(_0002fjdbc_0002ejspjdbc_jsp_0.java:730
)
        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.java:1
77)
        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:797)
        at 
org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
        at 
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConne
ctionHandler.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)
Comment 1 Morgan Delagrange 2001-03-21 09:22:33 UTC
InstantDB does not support standard double tick SQL escaping.  I'm not sure if 
we should simply leave InstantDB unsupported, or if we use another means of 
escaping.
Comment 2 Ignacio J. Ortega 2001-05-21 07:07:26 UTC
Changed product to taglibs from Tomcat 3
Comment 3 Glenn Nielsen 2001-07-22 10:12:34 UTC
This should be assigned to the DBTags taglib.