Trouble with SQL in JSTL

I'm trying to learn to use the JSTL, but it isn't going so well. Using scriptlets, I wrote this JSP that works just fine:
<HTML>
     <HEAD>
          <TITLE> <%= request.getParameter("txtTitle") %> </TITLE>
          <%@ page import="java.sql.*, java.util.*" %>
          <%
               Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
               Connection conn = DriverManager.getConnection("jdbc:odbc:RDM_CURRENT_11", "name", "pword");
               Statement getResults = conn.createStatement();
               ResultSet rs = getResults.executeQuery(request.getParameter("txtQuery"));
               ResultSetMetaData rsmd = rs.getMetaData();
          %>
     </HEAD>
     <BODY>
          <H1><%= request.getParameter("txtTitle") %></H1>
          <TABLE BORDER="1">
               <%
                    int count = 0;
                    while (rs.next())
               %>
                         <TR>
                              <%
                                   for (int i = 1; i <= rsmd.getColumnCount(); i++)
                              %>
                                        <TD>
                                             <%= rs.getString(i) %>
                                        </TD>
                              <%
                                   count++;
                              %>
                         </TR>
               <%     } %>
               </TABLE>
               <P> Records returned: <%= count %> </P>
     </BODY>
</HTML>I tried to translate most of this into JSTL as follows:
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql" %>
<HTML>
     <HEAD>
          <TITLE> <c:out value="${param.txtTitle}"/> </TITLE>
     </HEAD>
     <BODY>
          <sql:setDataSource url="jdbc:odbc:RDM_CURRENT_11" driver="sun.jdbc.odbc.JdbcOdbcDriver" user="name" password="pword" var="RDM"/>
          <sql:query var="dataSet" dataSource="RDM">
               <c:out value="${param.txtQuery}"/>
          </sql:query>
          <H1><c:out value="${param.txtTitle}"/></H1>
          <TABLE BORDER="1">
               <c:forEach var="row" items="${dataSet.rows}">
                    <TR>
                         <c:forEach var="col" items="${row}">
                              <TD>
                                   <c:out value="${col.value}"/>
                              </TD>
                         </c:forEach>
                    </TR>
               </c:forEach>
          </TABLE>
     </BODY>
</HTML>Now, I get a nasty error message from Tomcat saying:
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Unable to get connection, DataSource invalid: "java.sql.SQLException: No suitable driver"
     org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:845)
     org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:778)
     org.apache.jsp.queryDisplay2_jsp._jspService(org.apache.jsp.queryDisplay2_jsp:97)
     org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
     org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
     org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
     org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "java.sql.SQLException: No suitable driver"
     org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.getConnection(QueryTagSupport.java:276)
     org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(QueryTagSupport.java:159)
     org.apache.taglibs.standard.tag.el.sql.QueryTag.doStartTag(QueryTag.java:85)
     org.apache.jsp.queryDisplay2_jsp._jspx_meth_sql_query_0(org.apache.jsp.queryDisplay2_jsp:152)
     org.apache.jsp.queryDisplay2_jsp._jspService(org.apache.jsp.queryDisplay2_jsp:77)
     org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
     org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
     org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
     org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.4 logs.
Apache Tomcat/5.5.4I know my OBDC data source must be set up correctly because the scriptlet version works, but the JSTL version doesn't. I'm sure this is some easy problem that I am missing because I don't know JSTL well at all. Any help is appreciated.

If you don't provide a "var" attribute to export to, JSTL keeps track of it for you in the standard pageContext attribute "javax.servlet.jsp.jstl.sql.dataSource"
The query tag obviously found the datasource there.
Just spotted what I think might be your original problem:
You need ${  } signs around the datasource variable in the query tag.
ie
<sql:setDataSource url="jdbc:odbc:RDM_CURRENT_11" driver="sun.jdbc.odbc.JdbcOdbcDriver" user="name" password="pword" var="RDM"/>
<sql:query var="dataSet" dataSource="${RDM}">Cheers,
evnafets

Similar Messages

  • Trouble with SQL Expressions

    Hello everyone,
    I'm having trouble with this SQL expression that works in 8.5, and XI R2 runtime and designer, but I cannot edit the expression.  As soon as I open the SQL Expression and click the X-2 check button, the error following
    SQL Expression I'm trying to run:
    (Select Distinct b1.CandEmploymentType
        from ceistaffing a1
        inner join ceisubmittal b1 on a1.submittalid = b1.ceisubmittalid
    Where a1.Staffingchainid = CEIHRPROJECTEDACTUAL."STAFFINGCHAINID"
        and b1.createdate in (Select max(b2.createdate) from ceistaffing a2 inner join ceisubmittal b2 on a2.submittalid = b2.ceisubmittalid where a2.staffingchainid = a1.staffingchainid))
    The Errror I Receive After Clicking the X-2 button:
    Crystal Reports
    Error in compiling SQL Expression :
    Failed to retrieve data from the database.
    Details: ADO Error Code: 0x
    Source: SalesLogix OLE DB Provider
    Description: The multi-part identifier "CEIHRPROJECTEDACTUAL.STAFFINGCHAINID" could not be bound.
    Native Error:  [Database Vendor Code: 181797304 ].
    OK  
    This is the SQL statement passed to the database:
    SELECT (Select Distinct b1.CandEmploymentType
    from ceistaffing a1
    inner join ceisubmittal b1 on a1.submittalid = b1.ceisubmittalid
    Where a1.Staffingchainid = CEIHRPROJECTEDACTUAL."STAFFINGCHAINID"
    and b1.createdate in (Select max(b2.createdate) from ceistaffing a2 inner join ceisubmittal b2 on a2.submittalid = b2.ceisubmittalid where a2.staffingchainid = a1.staffingchainid))
    If I reverse the order of the where clause as follows, I do not get the error
    (Select Distinct b1.CandEmploymentType
    from ceistaffing a1
    inner join ceisubmittal b1 on a1.submittalid = b1.ceisubmittalid
    Where CEIHRPROJECTEDACTUAL."STAFFINGCHAINID" = a1.Staffingchainid
    and b1.createdate in (Select max(b2.createdate) from ceistaffing a2 inner join ceisubmittal b2 on a2.submittalid = b2.ceisubmittalid where a2.staffingchainid = a1.staffingchainid))
    This is the working SQL statement passed to the database.
    SELECT (Select Distinct b1.CandEmploymentType
    from ceistaffing a1
    inner join ceisubmittal b1 on a1.submittalid = b1.ceisubmittalid
    Where CEIHRPROJECTEDACTUAL."STAFFINGCHAINID" = a1.Staffingchainid
    and b1.createdate in (Select max(b2.createdate) from ceistaffing a2 inner join ceisubmittal b2 on a2.submittalid = b2.ceisubmittalid where a2.staffingchainid = a1.staffingchainid))
    FROM   "sysdba"."CEIHRPROJECTEDACTUAL" "CEIHRPROJECTEDACTUAL"
    I figured I would just reverse the where clause statements, but then I came to this one that I couldn't get to work:
    (Select case when tmp.restartcount = 0 then 'F' else 'T' end from
    (Select Count(b.restart) as restartcount from ceistaffing a inner join ceihrprojectedactual b on a.staffingchainid = b.staffingchainid
    where a.candcontactid = (Select distinct candcontactid from ceistaffing a2 where a2.staffingchainid = CEIHRPROJECTEDACTUAL."STAFFINGCHAINID")
    and b.restart = 'T'
    and a.createdate = (Select min(a1.createdate) from ceistaffing a1
                   where a1.createdate > (Select max(a3.createdate)
                                  from ceistaffing a3
                                  where a3.staffingchainid = CEIHRPROJECTEDACTUAL."STAFFINGCHAINID")
                   and a1.candcontactid = a.candcontactid)) as tmp )
    I've burned an entire day trying to find some solution.  Are there any patches out there that will fix this?
    I'm running Crystal Report XI Release 2 SP2 - Version 11.5.8.826
    Thank you, ...Rob

    Okay, to simplify the illustration of the problem Iu2019m facing, Iu2019ve created a bare bones example as described below:
    I've created a report that returns all contacts from our "CONTACT" table.  On the report, I've created a SQL expression to return a count of all contacts with the similar last name, as shown below:
    (Select count(a1.ContactID) from CONTACT a1 where a1.LASTNAME = "CONTACT"."LASTNAME")
    When I try to save the SQL expression,  I get this error:
    Crystal Reports
    Error in compiling SQL Expression :
    Failed to retrieve data from the database.
    Details: ADO Error Code: 0x
    Source: SalesLogix OLE DB Provider
    Description: The multi-part identifier "CONTACT.LASTNAME" could not be bound.
    Native Error:  [Database Vendor Code: 205193720 ].
    OK  
    This SQL expression works fine in CRW 8.5, but no luck in XI R2 SP4 - As mentioned above in the thread, this seems to be an issue solely with how XI R2 is parsing the SQL Expression.  If I remove the "A1" alias from my expression all is good, but that will not work for some of the more advanced SQL expressions I have that are using joins and sub queries.
    What will it take to get this recognized as an issue worthy of a hot fix?  I'm at a stand-still here, facing the unfortunate possibility of having to re-architect many of my reports.  Please help.
    Thank you, ...Rob
    Edited by: Rob Bartram on Aug 6, 2008 3:45 PM

  • Trouble with SQL Anywhere 16

    We are having an issue with SQL Anywhere 16 and were wondering if there is a patch/fix or something that we need to look elsewhere. Our tester is being kicked out of out Sybase application whenever doing certain types of queries and as a result the database is being shutdown. We then have to go back into Sybase 16 and restart the database. We do not recall having this problem with SQL Anywhere 11.5. We have just recently upgraded to SQL Anywhere 16.

    Hi Lawrence,
    I think there's some confusion from both groups on this question. There was never a SQL Anywhere 11.5 version - we had SQL Anywhere 11.0.0, and SQL Anywhere 11.0.1. There was an ASE 11.5 and ASE 16.0 release though, so it is confusing to know which product you are inquiring about based on the version.
    Please provide some further details about which product you are using, the method in which you're using to start your database, and the connection strings that you're using. Hopefully with some more specific database configuration information, we can help you figure out which database product you're looking for additional help on and provide some suggestions.
    Thanks,
    Jeff Albion
    SAP Active Global Support

  • Trouble with SQL datetime format

    I have written a VI to import a CSV file into a SQL data table but I
    cannot get it to work when using a table with "datetime" data
    format.  It will import into a new table with undefined data
    formats as "varchar" format but no luck when going into a table with the "datetime" data
    format.   I need the datetime format for date/time queries later.
    I have attached a zip file of my VI and the CSV file.  Is there a problem with my CSV format or I am I doing
    something else wrong here?
    Please help.
    Thanks,
    Greg
    Attachments:
    SQL issue.zip ‏54 KB

    Greg
    I have just tried to insert your data into a SQL Server (MSDE) database.
    I found that the INSERT data didn't work. The TRUE for Create Table didn't seem to do any thing. So I created a table using labview like this
    And this is its design.
    I then run the vi again and it starts to work with no issues. So it looks like the Create Table?=TRUE for the INSERT doesn't seem to work on SQL Server. It looks like you need to create the table first.
    Here is your data in the database
    Let me know what you think
    David
    Message Edited by David Crawford on 04-28-2006 11:17 AM
    Attachments:
    Your Data.jpg ‏32 KB
    Create Table.jpg ‏20 KB
    Table Design.jpg ‏15 KB

  • Trouble with SQL loader

    Hello there,
    I am trying to load some data to a temp table for normalization but I am getting errors and nothing loads.
    My table is as below
    CREATE TABLE CA(
    OLD_SYSTEM_ID   VARCHAR2(25),
    OLD_DESCRIPTION VARCHAR2(35),
    ORDER_DATE      DATE,
    SHIP_DATE       DATE,
    QUANTITY        NUMBER);My Control file is like this
    LOAD DATA
    INFILE Ca.fwf
    BADFILE Ca.bad
    INTO TABLE CA
    old_system_id    POSITION (1:19) VARCHAR2,
    old_description  POSITION (20:27) VARCHAR2,
    order_date       POSITION (28:35) DATE,
    ship_date        POSITION (36:43) DATE,
    quantity         POSITION (44:47)
    )And my data is like this:
    CA-91003-KTS:2452-10000218619930205199303021
    CA-91003-KTS:2452-2000009171993020519930302100
    CA-91003-KTS:2452-3000009261993020519930302500
    CA-91003-KTS:2452-40000094619930205199303025
    CA-91003-KTS:2477-10000218619930319199304141
    CA-91003-KTS:2477-2000009171993031919930414100
    CA-91003-KTS:2477-3000009261993031919930414500
    CA-91003-KTS:2477-40000094619930319199304145
    CA-91003-KTS:2497-10000218619930519199306141I get this error:
    SQL*Loader: Release 9.2.0.1.0 - Production on Tue Oct 3 10:16:00 2006
    Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
    SQL*Loader-350: Syntax error at line 6.
    Expecting valid column specification, "," or ")", found "VARCHAR2".
    old_system_id    POSITION (1:19) VARCHAR2,Any ideas why? this is happening on 8 different loads although they are all similar, is it to do with VARCHAR2 and commas?
    Regards
    Mike

    What happens when you try to load without any date mask? Does it get rejected? May be you should request your upstream system to send the date values in similar format?.
    If there are going to be only two formats i.e.,DD-MON-YY and DD/MM/YY then you can use decode function. something like below
      "decode(instr(:order_date,'-'),0,to_date(:order_date,'DD/MM/YY'),to_date(:order_date,'DD-MON-YY'))"Post the code which you tried. I dont have acces to database at home so the above code snippet is not tested.

  • Trouble with sql

    hi there
    i have connected my java application to a ms acess
    database succsssfully but when i include sql commands
    in the application it brings errors during compilation
    it points to the commands
    i imported java.sql;
    but it seams the compiler still does not recorgnise the
    commands.
    what could be the problem, please help.

    but when i include sql commands
    in the application it brings errors during
    compilation
    it points to the commandsIf you mean with "include sql command" putting a SQL command directly into the code, this doesn't work (at least not without a special pre-compiler)
    Post your code and maybe we can help you.
    Thomas

  • Trouble with SQL Statements

    Hello all that can help,
    i am programming in Ready to Program to connect to a VideoShop database using SQL statements.
    I am having trouble when using single and double inverted commas. eg vs.updateRentTable ("DELETE FROM RentTable WHERE CustId=);
    but instead of specifiying the CustId i want to make it a variable id so that i can delete any name i want according to their ID.
    also i am wondering if it is possible to write data from a database into a text file? is it possible to use Printwriter?
    Looking forward to your help,
    Manuking16

    Hi Manuking_16,
    Your question should be posted on a sql forum, not on a JDBC forum. Anyway. Just looking for answers, right?
    1) If your datatype is INT, you do not use either quotes " or single quotes in your SQL statement
    DELETE FROM RentTable WHERE CustId= 12345.
    To build the SQL String in JAVA just write:
    {code}String sqlStatement = "DELETE FROM RentTable WHERE CustId = " + custID; // custID will be casted to String.{code}
    2) Use preparedStatement
    {code}PreparedStatement pStm = conn.prepareStatement(�DELETE FROM RentTable WHERE CustId = ?");
    pStm.setInt(1, customerID);
    int numberOfDeletedLines = pStm.execute();3) If you want to enter the real name to do the deletion
    DELETE FROM RentTable WHERE CustId IN (select custID FROM Customer WHERE name = "joe bob johnson")
        To build the SQL String in JAVA just write: String sqlStatement = "DELETE FROM RentTable WHERE CustId IN (select custID FROM Customer WHERE name = '" + sCustomerName + "' )"; // just copy & pasteHope I got your question right.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Trouble with SQL Query Tool on Leopard

    I have been following the lessons in Ben Forta's book Adobe
    ColdFusion 8 Getting Started, and have installed the SQL query tool
    in my Mac and have installed the sql folder in
    http://localhost:8501/db/ows/sql/index.cfm
    When I try to open the file in the browser, I get a 404 error: File
    not found: /db/ows/sql/index.cfm
    Have tried rebooting the computer and get the same result.
    What's going on?
    TIA

    I have copied the full code for the error message below.
    Paul D
    404
    File not found: /db/ows/sql/index.cfm
    coldfusion.runtime.TemplateNotFoundException: File not found:
    /db/ows/sql/index.cfm
    at coldfusion.filter.PathFilter.invoke(PathFilter.java:89)
    at
    coldfusion.filter.LicenseFilter.invoke(LicenseFilter.java:27)
    at
    coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70)
    at
    coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:2 8)
    at
    coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
    at
    coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:46)
    at
    coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
    at
    coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
    at coldfusion.CfmServlet.service(CfmServlet.java:175)
    at
    coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
    at jrun.servlet.FilterChain.doFilter(FilterChain.java:86)
    at
    coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42 )
    at
    coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
    at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
    at jrun.servlet.FilterChain.service(FilterChain.java:101)
    at
    jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)
    at
    jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
    at
    jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286)
    at
    jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)
    at
    jrun.servlet.http.WebService.invokeRunnable(WebService.java:172)
    at
    jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320)
    at
    jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
    at
    jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266)
    at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)

  • Trouble with sql dates getting Monday of this week

    Hi
    How do I get the Monday of this week. I am using:
    <code>next_day(trunc(sysdate,'DAY'),'Monday')</code>
    but get the coming Monday. Initially this code was working before apex was upgraded from 3.0 to 3.1.
    Why would this stop working.
    But if I was to use
    <code>next_day(trunc(sysdate,'DAY'-7),'Monday')</code>
    thanks
    Tony

    Hi Scott
    thats what I thought but I was not getting the present week's Monday. I am trying to get the Sunday and Monday of the present week so have had to put a
    -7 next to the sysdate.
    The Application I have been using was running in but when there was an upgrade to apex 3.1 then the returned dates have not been correct.
    thanks
    Tony

  • Oracle XML Parser for PL/SQL - troubles with charset

    Hi,
    I'm using Oracle XML Parser for PL/SQL and have some troubles with charset of results xmldom.writeToBuffer and xmldom.writeToCLOB procedures.
    Some tags in my DOM documents contain text values in RUSSIAN (server nls_charset is CL8ISO8859P5). When I write document in varchar2 variable, buffer content is in UTF8 charset ( convert UTF8->CL8ISO8859P5 -OK).
    xmldom.setCharset(doc, 'ISO-8859-5') just after xmldom.newDOMDocument has no effect.
    xmldom.setCharset(doc, 'CL8ISO8859P5') has no effect also.
    Explicit charset direction in third parameter of
    xmldom.writeToBuffer and xmldom.writeToCLOB procedure has no effect.
    When I write document in CLOB, and then read part of CLOB in varchar2 buffer - result contain '?' in place of all russian text characters.
    What's a problem?
    How can I force XML Parser write XML in server charset?
    Oracle XML Parser for PL/SQL v 1.0.2

    I have the same problem. But in my case I am allowed only to use XML Parser for PL/SQL.
    Characterset 'WE8ISO8859P1' is used. And the language is latvian.
    After parsing a XML document and printing its contents, all latvian characters are replaced by "f".
    xmldom.setcharset(doc,'WE8ISO8859P1') has no effect.

  • Trouble with JSTL functions uri

    I have JSTL 1.1 installed, am using J2EE 1.3 on Websphere 5.0 and am referencing 2.3 DTD in my web.xml. I have the jstl.jar, standard.jar, jdbc2_0-stdext.jar, xalan.jar and xercesImpl.jar in WEB-INF/lib
    I can successfully use the core JSTL functions with
    <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> but have not been able to get the functions URI to work.
    I have tried the two listed below
    <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
    <%@ taglib uri="http://java.sun.com/jstl/functions" prefix="fn" %>
    but get the error:
    [Servlet Error]-[File "http://java.sun.com/jsp/jstl/functions" not found]: org.apache.jasper.JasperException: File "http://java.sun.com/jsp/jstl/functions" not found
    Can someone please tell me what I am doing wrong or if I am trying to use something that I shouldn't with my setup. I have only started using JSTL this week and have a lot left to learn.
    Thanks!

    I want to use JSTL 1.1 tags if possible. Not possible given your environment.
    Its on the header of the taglibs site:
    Standard-1.1 (JSTL 1.1) requires a JSP container that supports the Java Servlet 2.4 and JavaServer Pages 2.0 specifications. (http://jakarta.apache.org/taglibs/doc/standard-doc/intro.html)
    Websphere 5.0 supports only Servlet 2.3 and JSP 1.2. Thus you can only use JSTL1.0 with it. JSTL 1.0 does not define these functions.
    Sorry, but thats the way things are.
    Cheers,
    evnafets

  • A trouble with "LIKE" in a select statement

    Hi!
    I'm having trouble with "LIKE" in a select statement...
    With Access I can make the following and everything works well:
    SELECT name, birthday
    FROM client
    WHERE birthday LIKE '*/02/*';
    but if try to do it in my application (it uses Access), it doesn't work - I just can't understand that!!!
    In my application the "month" is always the currently month taken from the "System". Look what I'm doing...
    String query1 = "SELECT name, birthday " +
              "FROM client " +
              "WHERE birthday " +
              "LIKE '*/" +
              pMonth +
              "/*' " +
              "ORDER BY birthday ASC ";
    ResultSet rs = statement1.executeQuery(consulta1);
    boolean moreRecords = rs.next();
    The variable "moreRecords" is always "false", the query returns nothing although the table "client" has records that attend the query.
    Please, anyone can help me?! It's a little bit urgent.
    Thanks,
    Katia.

    Hi Katia,
    I'll bet the problem lies with the characters you're using to escape the LIKE clause. You're using the ones that Access likes to see, but that's not necessarily what's built into the JDBC-ODBC driver class.
    You can find out what the correct escape wildcard characters are from the java.sql.DatabaseMetaData.getSearchStringEscape() method. It'll tell you what to use in the LIKE clause.
    I'm not 100% sure about your code. It doesn't use query1 anywhere. I'd do this:
    String query = "SELECT name, birthday FROM client WHERE birthday LIKE ? ORDER BY birthday ASC";
    PreparedStatement statement = connection.createStatement(query);
    String escape = connection.getMetaData().getSearchStringEscape();
    String test = escape + '/' + pMonth + '/' + escape;
    statement.setString(1, test);
    ResultSet rs = statement.executeQuery();
    while (rs.hasNext())
    // load your data into a data structure to pass back.
    rs.close();
    statement.close();Let me know if that works. - MOD

  • Having trouble connecting SQL Developer to database on LINUX machine

    Having trouble connecting SQL Developer to database on LINUX machine
    Hello,
    I am trying to connect my windows 7 home premium machine to an oracle database 11g on a RedHat 5 machine using SQL Developer. i got this error message on SQL Developer
    Status : Failure - Test failed :The Network Adapter could not establish the connection
    on Linux
    LSNRCTL> status
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
    STATUS of the LISTENER
    Alias                     LISTENER
    Version                   TNSLSNR for Linux: Version 10.2.0.1.0 - Production
    Start Date                03-APR-2013 16:13:13
    Uptime                    7 days 22 hr. 16 min. 41 sec
    Trace Level               off
    Security                  ON: Local OS Authentication
    SNMP                      OFF
    Listener Parameter File   /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
    Listener Log File         /u01/app/oracle/product/11.2.0/db_1/network/log/listener.log
    Listening Endpoints Summary...
    (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.X.X.X)(PORT=1521)))
    Services Summary...
    Service "PLSExtProc" has 1 instance(s).
    Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
    Service "orc11g" has 1 instance(s).
    Instance "orc11g", status READY, has 1 handler(s) for this service...
    Service "orc11gXDB" has 1 instance(s).
    Instance "orc11g", status READY, has 1 handler(s) for this service...
    Service "orc11g_XPT" has 1 instance(s).
    Instance "orc11g", status READY, has 1 handler(s) for this service...
    The command completed successfully
    LSNRCTL> and TNSPING
    tnsping 172.x.x.x
    TNS Ping Utility for Linux: Version 10.2.0.1.0 - Production on 11-APR-2013 14:32:17
    Copyright (c) 1997, 2005, Oracle.  All rights reserved.
    Used parameter files:
    /u01/app/oracle/product/11.2.0/db_1/network/admin/sqlnet.ora
    Used EZCONNECT adapter to resolve the alias
    Attempting to contact (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=172.x.x.x))(ADDRESS=(PROTOCOL=TCP)(HOST=172.x.x.x)(PORT=1521)))
    OK (0 msec)
    [oracle@ltebilling ~]$Tnsnames.ora On Linux ,
    ORC11G =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 172.x.x.x)(PORT = 1521))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = orc11g)
    )Listner on Linux ,
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = PLSExtProc)
    (ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
    (PROGRAM = extproc)
    LISTENER =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
    (ADDRESS = (PROTOCOL = TCP)(HOST = 172.x.x.x)(PORT = 1521))
    )/ect/hosts Linux ,
    # Do not remove the following line, or various programs
    # that require network functionality will fail.
    127.0.0.1               localhost.localdomain localhost
    172.x.x.x             LTEBillingand there is no problem of ping linux from windows
    Edited by: user11309581 on Apr 11, 2013 3:16 PM

    yes really i'm already enaple the port 1521 and SELINUX=disabled
    [root@ltebilling ~]# /etc/init.d/iptables status
    Table: filter
    Chain INPUT (policy ACCEPT)
    num  target     prot opt source               destination
    1    RH-Firewall-1-INPUT  all  --  0.0.0.0/0            0.0.0.0/0
    Chain FORWARD (policy ACCEPT)
    num  target     prot opt source               destination
    1    RH-Firewall-1-INPUT  all  --  0.0.0.0/0            0.0.0.0/0
    Chain OUTPUT (policy ACCEPT)
    num  target     prot opt source               destination
    Chain RH-Firewall-1-INPUT (2 references)
    num  target     prot opt source               destination
    1    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0
    2    ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0           icmp type 255
    3    ACCEPT     esp  --  0.0.0.0/0            0.0.0.0/0
    4    ACCEPT     ah   --  0.0.0.0/0            0.0.0.0/0
    5    ACCEPT     udp  --  0.0.0.0/0            224.0.0.251         udp dpt:5353
    6    ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0           udp dpt:631
    7    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:631
    8    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED
    9    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:1521
    10   ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:22
    11   REJECT     all  --  0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibitedbut from windows system when i'm try tnsping i got this error
    C:\Windows\system32>tnsping orc11g
    TNS Ping Utility for 64-bit Windows: Version 11.2.0.1.0 - Production on 11-APR-2
    013 14:44:09
    Copyright (c) 1997, 2010, Oracle.  All rights reserved.
    Used parameter files:
    D:\app\ubai\product\11.2.0\dbhome_2\network\admin\sqlnet.ora
    Used TNSNAMES adapter to resolve the alias
    Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 172.x.x
    .x)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orc11g))
    TNS-12535: TNS:operation timed out
    C:\Windows\system32>

  • Trouble with form on a view

    Hi,
    I have trouble with the ROWID (ORA-01445) error when running the standard doQuery function on a button in a Form.
    Is it possible to use doQuery or do I have to write my own PL/SQL code, if so where can I find information on this (like the code for doQuery would be nice).
    thanks
    Jvrgen Swensen
    null

    Jvrgen
    This question is best asked in the Oracle9iAS Portal Applications Forum:
    http://technet.oracle.com:89/cgi-bin/forumdisplay.cgi?action=topics&forum=Oracle9<i>i</i>AS+Portal+Applications&number=81&DaysPrune=20&LastLogin=
    null

  • In Trouble with the Oracle JDBC Driver version - 10.1.0.5.0

    Hi !
    Without any problems i'm using the Oracle JDBC Driver version - 10.1.0.3.0 to access to the
    Oracle database (Oracle Database 10g Release 10.2.0.1.0 - 64bit Production).
    But exchanging the JDBC Driver 10.1.0.3.0 to 10.1.0.5.0 brings up the following problem:
    the statement
         con.prepareStatement(sql, resultSetType, resultSetConcurrency, resultSetHoldability)
         (with parameters resultSetType = 1003, resultSetConcurrency = 1007, resultSetHoldability= 1)
    returns null !
    while using the Oracle JDBC Driver version - 10.1.0.3.0 the statement (with same parameters)
    returns a correct PreparedStatement.
    Every hint or idea is welcome.
    Best regards,
    Claus

    Duplicate post:
    In Trouble with the Oracle JDBC Driver version - 10.1.0.5.0
    Claus,
    Pardon me if I am stating the obvious, but why don't you use the 10.2 JDBC driver with your 10.2 database? The driver is part of the database distribution. Otherwise, you can download the driver from the OTN Web site.
    Good Luck,
    Avi.

Maybe you are looking for

  • Not able to get out of 24hr time....help

    Ok I bought two 6300s today. Put a new theme on both so it's better to tell them apart. Now they BOTH have the same theme (so I could see why it was not working) and one can NOT show 12 hour time in the theme while the other one can & does show 12 ho

  • Custom Attribute not available in Available Fields section of Configuration

    Hi Experts, My requirement is to add a custom search field in contact search screen. For that i tried various options Option1 Added a model attribute in component/view  BP_CONT SEARCH/Search. The attribute got successfully added. But when i opened th

  • Copy and paste a Text-Layer to another picture - Its not a Textlayer more

    Hello, i tried to copy a text-layer from one psd-Picture and i want to paste it into  other pictures: var dok_textebene = app.documents.getByName ("text.psd"); dok_textebene.artLayers["name of the textlayer"] .copy() ;            //chage to a other p

  • HOW-TO CLUSTER BOBJ XI 3.1 on HP-UX with MySQL

    Hello, I need to understand how to perform an installation of BOBJ XI 3.1 on HP-UX in a cluster. The official documentation it's a bit weird. Someone  can give more hints on the steps to follow? what should be installed on the first node , what in th

  • Running Predictive/Progresive outbound campaigns without the use of IVR

    Is it possible to run a predict/progers outbound campaign with a 3:1 (port:agent) ratio without the use of ivr could i instead place the customers on hold somewhere in icm while the agents are busy? just a thought...