SQL query works in access 2000 but not through JDBC

Hello to all as my first posted message, I have a bit of a pickle on my hands. I have a query which is critical to for my application to function.
In Access 2000
SELECT sb.SeatName
FROM SeatBooking sb, Movie m, MovieSession ms, Booking b
WHERE m.MovieId = ms.MovieId
AND ms.MovieSessionId = b.MovieSessionId
AND b.BookingId = sb.BookingId
AND ms.DateOfSession = #2003/04/16 07:15:00 PM#;
This query works fine. When I insert it into my code
String query = "SELECT sb.SeatName \n" +
"FROM SeatBooking sb, Movie m, MovieSession ms, Booking b \n" +
"WHERE m.MovieId = ms.MovieId \n" +
"AND ms.MovieSessionId = b.MovieSessionId \n" +
"AND b.BookingId = sb.BookingId \n" +
"AND ms.DateOfSession = #" +
cp.getMovieSessionAt(i).getTrueTimeOfSession() + "#;";
The last line of code returns #2003/04/16 07:15:00 PM#; Which is the exact same as in Access.
To rule out some possibilities
- there are other less complicated queries which access the same database but work fine. so my code seems to be ok
- I have tried to use Format() on ms.DateOfSession to match the return value of the java statement (Which is a general date in Access in the format of 16/04/2003 7:15:00 PM)
Any suggestions would be appreciated!

Hi Simon,
On my Windows XP system with J2SE SDK version 1.4.1_02 and Micro$oft Access 2002, I have the following table:
column name    column type
id             Number
name           Text
updated        Date/TimeUsing the JDBC-ODBC bridge driver (that is part of the J2SE distribution), the following code uses the JDBC "escape" syntax -- and it works.
import java.sql.*;
public class JdbcOdbc {
  public static void main(String[] args) {
    Connection dbConn = null;
    ResultSet rs = null;
    Statement stmt = null;
    String sql =
      "SELECT * FROM Table1 WHERE updated = {ts '2003-04-13 07:53:23'}";
    try {
      Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
      dbConn = DriverManager.getConnection("jdbc:odbc:db1");
      stmt = dbConn.createStatement();
      rs = stmt.executeQuery(sql);
      if (rs.next()) {
        System.out.println("id      = " + rs.getInt(1));
        System.out.println("name    = " + rs.getString(2));
        System.out.println("updated = " + rs.getTimestamp(3));
    catch (SQLException sqlEx) {
      System.err.println("Database operation failed.");
      sqlEx.printStackTrace();
    catch (ClassNotFoundException cnfEx) {
      System.err.println("JDBC driver class not found");
      cnfEx.printStackTrace();
    finally {
      if (rs != null) {
        try {
          rs.close();
        catch (SQLException sqlEx) {
          System.err.println("ERROR: Failed to close result set");
          sqlEx.printStackTrace();
      if (stmt != null) {
        try {
          stmt.close();
        catch (SQLException sqlEx) {
          System.err.println("ERROR: Failed to close statement");
          sqlEx.printStackTrace();
      if (dbConn != null) {
        try {
          dbConn.close();
        catch (SQLException sqlEx) {
          System.err.println("ERROR: Failed to close DB connection");
          sqlEx.printStackTrace();
}More details about the JDBC escape syntax are available here:
http://java.sun.com/j2se/1.4.1/docs/guide/jdbc/getstart/statement.html#999472
Hope this helps you.
Good Luck,
Avi.

Similar Messages

  • SQL Query works in Simulator VC but not in flash deploy

    Hi:
    This is the select that works in VC's simulator:
    SELECT
    "t1"."VUELO", "t1"."HORA SALIDA", "t1"."DURACION", "t1"."ORIGEN", "t1"."DESTINO", "t1"."DIAS"
    FROM
    "RPADMIN"."VUELOS_SEMANAL_EPN_VIRGO" "t1"
    WHERE
    "t1"."DIAS" LIKE <b>'%1%'</b>
    ORDER BY "t1"."HORA SALIDA" ASC
    The big problem seems to be the LIKE clause, I need to find all records that have the number one.
    If I select the Simulator tab the data is bring on but If I perform a flash deploy a null message is display at app's execution. The system is well define and If I change the LIKE clause for LIKE <b>'1'</b> the flash app brings data (not all the records that contains the number 1).
    Thanks a lot for the time on this thread.
    RLS

    Thanks Prakash Darj.
    I read that PDF before starting the thread but I can't make it work...I read it once again and no luck...
    My app is a basic one: start point with a link to a SQL statement linked to a result table
    <b>The SQL sentences that work at the simulator don't work for a flex app, Did you know the reason?</b>
    Often I get this error when deploying as flash app:
    Error in executing a process for Flex compilation, Error 1103: There is no property with the name 'NEUQUEN'.
          (D:\usr\sap\PD0\JC00\j2ee\cluster\server0\GUIMachine_Business_Packages\ModelName_20931\FLEX_COMPILATION_FOLEDR\AAD1W1.mxml:205)
    Failed to compile AAD1W1.mxml
    Is it that my VC is not working fine?
    I want to know the reason for what the Simulator display the data and not the flex app...is the same app....
    any Idea?
    Thanks so much for the time on this thread and for your answer.
    RLS

  • SQL query works for Access but not mySQL

    *I'm using the Database Connectivity VIs* Can anyone give me a clue as to why the following query works with an MS Access File DSN but not a mySQL File DSN:
    SELECT * FROM (SELECT * FROM WP100598 WHERE SerialNum LIKE '311022-05%' OR SerialNum LIKE '311022-07%') WHERE UTCTime > 1090882800 AND UTCTime < 1092870000 ORDER BY SerialNum desc
    Thank you, your help is much appreciated

    Hi,
    I don't think MySQL supports nested queries.
    Regards,
    Wiebe.
    "optobionics" wrote in message
    news:[email protected]..
    > *I'm using the Database Connectivity VIs* Can anyone give me a clue
    > as to why the following query works with an MS Access File DSN but not
    > a mySQL File DSN:
    > SELECT * FROM (SELECT * FROM WP100598 WHERE SerialNum LIKE
    > '311022-05%' OR SerialNum LIKE '311022-07%') WHERE UTCTime >
    > 1090882800 AND UTCTime < 1092870000 ORDER BY SerialNum desc
    > Thank you, your help is much appreciated

  • Cursor query works in anonymous block but not in procedure

    Hello,
    My cursor query works fine in anonymous blcok but fails in pl/sql block.
    Anonymous block:
    declare
    cursor c1 is
    select object_name
    from all_objects
    where owner='IRIS_DATA'
    and object_type='SEQUENCE';
    v_string varchar2(2000);
    begin
    for c2 in c1 loop
    v_string := 'DROP SEQUENCE IRIS_DATA.'||c2.object_name;
    execute immediate v_string;
    end loop;
    commit;
    exception
    when others then
    dbms_output.put_line('Exception :'||sqlerrm);
    end;
    works fine.
    but inside the procedure the it doesn't go inside the cursor loop
    procedure get_sequence is
    l_dp_handle NUMBER;
    v_job_state varchar2(4000);
    l_last_job_state VARCHAR2(30) := 'UNDEFINED';
    l_job_state VARCHAR2(30) := 'UNDEFINED';
    l_sts KU$_STATUS;
    v_logs ku$_LogEntry;
    v_row PLS_INTEGER;
    v_string1 varchar2(2000);
    cursor seq_obj is
    select object_name
    from all_objects
    where owner='IRIS_DATA'
    and object_type='SEQUENCE';
    begin
         log_status('get_sequence started.');
         --Cursor records to drop the sequences before importing.
         for seq_obj_rec in seq_obj loop
    log_status('get_sequence: Dropping sequence started.');
         v_string1 := 'DROP SEQUENCE IRIS_DATA.'||seq_obj_rec.object_name;
    execute immediate v_string1;
         end loop;
         log_status('get_sequence: Dropping sequence completed.');
    exception
    WHEN OTHERS THEN
    log_status('get_sequence: exception.');
    end get_sequence;
    it's not going into the seq_obj_rec cursor.
    I granted select on all_objects to the user.this user is also having the DBA role as well.
    Please advice.

    PROCEDURE Get_sequence
    IS
      l_dp_handle      NUMBER;
      v_job_state      VARCHAR2(4000);
      l_last_job_state VARCHAR2(30) := 'UNDEFINED';
      l_job_state      VARCHAR2(30) := 'UNDEFINED';
      l_sts            KU$_STATUS;
      v_logs           KU$_LOGENTRY;
      v_row            PLS_INTEGER;
      v_string1        VARCHAR2(2000);
      CURSOR seq_obj IS
        SELECT object_name
        FROM   all_objects
        WHERE  owner = 'IRIS_DATA'
               AND object_type = 'SEQUENCE';
    BEGIN
        Log_status('get_sequence started.');
        --Cursor records to drop the sequences before importing.
        FOR seq_obj_rec IN seq_obj LOOP
            Log_status('get_sequence: Dropping sequence started.');
            v_string1 := 'DROP SEQUENCE IRIS_DATA.'
                         ||seq_obj_rec.object_name;
            EXECUTE IMMEDIATE v_string1;
        END LOOP;
        Log_status('get_sequence: Dropping sequence completed.');
    EXCEPTION
      WHEN OTHERS THEN
                 Log_status('get_sequence: exception.');
    END get_sequence; How do I ask a question on the forums?
    SQL and PL/SQL FAQ
    scroll down to #9 & use tags in the future.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • SQL query works in the SQLPlus, but fires parse error after being cut and pasted into

    One of our client has a SQL query like this:
    SQL> SELECT LNAME,
    2 QUOTA/12,
    3 (SELECT SUM(CAMT) FROM CONSULTING WHERE CONSULTANT = P.EMPLOYEE
    4 AND ACTIVITYCODE = 'C'AND
    5 CDATE BETWEEN '01-JAN-2001' AND '31-JAN-2001') AS SUM,
    6 (SELECT SUM(CAMT) FROM CONSULTING WHERE CONSULTANT = P.EMPLOYEE
    7 AND ACTIVITYCODE = 'C'AND
    8 CDATE BETWEEN '01-JAN-2001' AND '31-JAN-2001') -
    QUOTA/12 AS PL
    9 FROM PERSONNEL P
    10 ORDER BY LNAME;
    Running the above query in the SQLPlus returns appropriate resultsets to the
    user. After the same SQL being cut and pasted into a portal report
    component, running the report component fires the following error:
    Failed to parse query
    Error:ORA-00911: invalid character (WWV-11230)
    Failed to parse as XXX - SELECT LNAME, QUOTA/12, (SELECT SUM(CAMT) FROM
    CONSULTING WHERE CONSULTANT = P.EMPLOYEE AND ACTIVITYCODE = 'C'AND CDATE
    BETWEEN '01-JAN-2001' AND '31-JAN-2001') AS SUM, (SELECT SUM(CAMT) FROM
    CONSULTING WHERE CONSULTANT = P.EMPLOYEE AND ACTIVITYCODE = 'C'AND CDATE
    BETWEEN '01-JAN-2001' AND '31-JAN-2001') - QUOTA/12 AS PL FROM PERSONNEL P
    ORDER BY LNAME; (WWV-08300)
    Cursor is not open
    Is this because of the multi-table queries, or something else? Is there any
    way around this? Any information regarding this will be highly appreciated.
    Thanks.
    null

    Sunny,
    From the error message that you posted it seems that you are putting a semicolon ";" at the end of your query. I checked the query that you have posted. It is working fine for me. (I am using 3.0.8) but I feel it will work in your version also. I tried the query without a ";" at the end --It worked.
    I tried with ";" at the end -- It gave the error that you have posted. So remove the ";" at the end and it should work. If you are still getting the same error then pls write down the version you are using. I will check in that version.
    Thanx,
    Chetan.

  • Ipod works on Windows 2000 but not on XP

    I have an empty Ipod click wheel unit . My Itunes library (about 1200 songs) is safely stored on cd's. I have Windows 2000 in the office and Windows XP at home. If I take the cd's and the Ipod to the office, I can get it to run perfectly. I restore the cd's to Itunes and upload them to my Ipod with no problems at all. When I bring the unit home, and plug it into my XP home system, it seems to have great difficulity recognizint the Ipod at all. The Ipod image pops on and off the my computer screen. If I fiddle with the Ipod for a while,just randomly selecting menu items, sometimes I can get it stabilized, at which point I get a message that it is sync ed to another computer. I try to resync it - sometimes it stays up and sometimes it drops out. If it stays on line, the Ipod sync window appears on the screen, and I get an immediate message "upload complete" from my empty Itunes library. I then load a cd to put something in the library to actually sync with, and it loads perhaps 10 or 15 items then I get a message "The Ipod - Patricia's Ipod can not be updated - The required file can not be found" It stops and nothing else will happen. I have tried different plugs, changing drive letter assignments, reloading firmware, complete restore, 5R's, everything I could find, but still I have no luck. My husband has a new Ipod video which operates perfectly with the same XP computer. So, why does it work perfectly with Windows 2000 and not at all with Windows XP?

    Check your firewire connection and/or Windows firewire driver. This is done in Device Manager.

  • Query working fine in toad but not in forms 6i

    i have following coding on when button press triger
    declare
    CURSOR C1(year number,month number) IS
    SELECT ITM_NO,ITM_NAME,XAQ QTY,XAQ*TP VAL,gp
    FROM
    select ci.itm_no ITM_NO,ci.itm_name ITM_NAME ,cpg.group_id gp ,xaq ,ALLIED.CORP_PRIC_TP( ci.itm_no)TP from
    select prod_no,sum(xaq)*1 xaq
    from
    select prod_no, sum(nvl(xrd_sqty,0)) Xaq
    from allied.mrk_01_02
    where year=year and f_prd=month
    and area_id in (10200,10400,10100,10300,10500,20500,20300,20100,20200,20400,30100,30400,30300,30200)
    group by prod_no
    union all
    select prod_no, sum(nvl(xrd_sqty,0)) Xaq
    from allied.mrk_02_02
    where year=year and f_prd=month
    and area_id in (10200,10400,10100,10300,10500,20500,20300,20100,20200,20400,30100,30400,30300,30200)
    group by prod_no
    union all
    select prod_no, sum(nvl(xrd_sqty,0)) Xaq
    from allied.mrk_03_02
    where year=year and f_prd=month
    and area_id in (10200,10400,10100,10300,10500,20500,20300,20100,20200,20400,30100,30400,30300,30200)
    group by prod_no
    union all
    select prod_no, sum(nvl(xrd_sqty,0)) Xaq
    from allied.mrk_04_02
    where year=year and f_prd=month
    and area_id in (10200,10400,10100,10300,10500,20500,20300,20100,20200,20400,30100,30400,30300,30200)
    group by prod_no
    group by prod_no
    ) A,allied.corp_inv ci,allied.corp_01_01 c01, allied.corp_01_02 c02,allied.corp_prod_group cpg,allied.v_prod_grp vpg
    where ci.itm_no=a.prod_no
    and ci.itm_no=c02.itm_no
    and c01.grp_id=c02.grp_id
    and c01.grp_id in(55,56,57,58,59)
    and vpg.prod_no =ci.itm_no
    and vpg.group_id=cpg.group_id
    where XAQ <>0;
    Begin
         delete from fiaz.tmp_topten_prod;
         for i in c1(:year,:month)
    loop
              insert into fiaz.tmp_topten_prod
              values(i.itm_no,i.itm_name,i.qty,i.val,i.gp,0);
         end loop;      
    standard.commit;
    message('inserted in temp');
         exception when others then
              message (dbms_error_text);
              message (dbms_error_text);
    End;
    Same Query (as used in cursor c1) works fine in toad but giving wrong result from forms... and the problem is xaq field i.e returns incorrect qty...
    i guess union clause is not working in this situation...
    plz suggest me the appropriate changes in the query to work well from form as well...
    combination:Forms 6i,Oracle 8.0.6
    Regards,
    Usman Afzal

    As per your suggestion i have created a stored procedure but the followin error prevents procedure creation
    create or replace procedure fiaz.topten_prod(v_yr number,v_mn number) is
    begin
    delete from fiaz.tmp_topten_prod;
    insert into fiaz.tmp_topten_prod(itm_no,itm_name,qty,val,grp_id,prority)
    SELECT ITM_NO,ITM_NAME,XAQ QTY,XAQ*TP VAL,gp,0
    FROM
    select ci.itm_no ITM_NO,ci.itm_name ITM_NAME ,cpg.group_id gp ,xaq ,ALLIED.CORP_PRIC_TP( ci.itm_no)TP from
    select prod_no,sum(xaq) xaq
    from
    select prod_no, sum(nvl(xrd_sqty,0)) Xaq from allied.mrk_01_02
    where year=v_yr and f_prd=v_mn
    and area_id in (10200,10400,10100,10300,10500,20500,20300,20100,20200,20400,30100,30400,30300,30200)
    group by prod_no
    union all
    select prod_no, sum(nvl(xrd_sqty,0)) Xaq
    from allied.mrk_02_02
    where year=v_yr and f_prd=v_mn
    and area_id in (10200,10400,10100,10300,10500,20500,20300,20100,20200,20400,30100,30400,30300,30200)
    group by prod_no
    union all
    select prod_no, sum(nvl(xrd_sqty,0)) Xaq
    from allied.mrk_03_02
    where year=v_yr and f_prd=v_mn
    and area_id in (10200,10400,10100,10300,10500,20500,20300,20100,20200,20400,30100,30400,30300,30200)
    group by prod_no
    union all
    select prod_no, sum(nvl(xrd_sqty,0)) Xaq
    from allied.mrk_04_02
    where year=v_yr and f_prd=v_mn
    and area_id in (10200,10400,10100,10300,10500,20500,20300,20100,20200,20400,30100,30400,30300,30200)
    group by prod_no
    group by prod_no
    ) A,allied.corp_inv ci,allied.corp_01_01 c01, allied.corp_01_02 c02,allied.corp_prod_group cpg,allied.v_prod_grp vpg
    where ci.itm_no=a.prod_no
    and ci.itm_no=c02.itm_no
    and c01.grp_id=c02.grp_id
    and c01.grp_id in(55,56,57,58,59)
    and vpg.prod_no =ci.itm_no
    and vpg.group_id=cpg.group_id
    where XAQ <>0;
    commit;
    end;
    Error:
    "PLS-00201: identifier ALLIED.MRK_01_02 must be declared "
    i have not changed any thing in query working fine in toad without create procedure text and if i describe this table it shows the structure (desc allied.mrk_01_02)
    Now where is the problemmmmm
    Plz Help

  • Query works in DB GUI, but not in CF

    Hello,
    I keep getting a CF error of "invalid character" for the
    attached query.
    Detailed error message: [Macromedia][Oracle JDBC
    Driver][Oracle]ORA-00911: invalid character
    I realize that's an Oracle error code, but the query works in
    an Oracle db GUI (Toad).
    Has anyone experienced this kind of situation?
    Thank you.

    I've never tried using DDL in a CFQUERY myself with an Oracle
    db, but you might try putting the entire statement inline (as in a
    single line), rather than breaking it out like you did. It would be
    hard to read, but it might parse better....... just a thought. I've
    had similar problems with EXECUTE statements within a CFQUERY that
    worked just fine when I rewrote them with no line breaks, etc.
    Phil

  • Query works as two queries, but not as one

    I am beating my head against the wall trying to figure out why a query will not return, yet when I break it up into two queries, they both return successfully.
    There is a text index on the text_a field.
    This is my query:
    select distinct /*+ */ table_c.rec_id
    from table_d, table_n, table_c
    where ( ((create_date >='2006-03-16T00:00:00Z')
    and (misc_field='abcd')
    and (contains( text_a,'ABC or DEF or GHI or JKL or MNP') > 0 ))
    /* and (rownum <=2000) */)
    and table_c.rec_id = table_d.rec_id
    and table_c.create_date = table_d.create_date
    and table_c.rec_id = table_n.rec_id
    and table_c.create_date = table_n.create_date
    This query will not return data. I get an ora-1555 every time I let it run. The longest I let it run before getting the 1555 error was 1 hr and 50 min.
    Tests suspecting a text data problem:
    Now, here's what's puzzling. The query will run if 'JKL' is taken out. So, I thought this value may be the problem, so I ran the query with just the 'JKL' value in the "contains" clause and it did not return a value.
    Tests suspecting a date problem:
    Now, even more strange: When I ran the query (with all 5 conditions for misc_field) and looked from 2006-03-17T00:00:00Z, it returned records in less than 5 minutes. Then I queries just the 16th (create_date>='2006-03-16T00:00:00Z' and create_date < '2006-03-17T00:00:00Z' and it returned rows in less than 1 minute. So, I looked at the tokens for those dates, and there are values for all of them for each of the dates from the 16th to the present (the 21st). However, when I put them together in the query above, the query just seems to hang.
    The total number of rows that should be returned is around 650 (adding the two results that worked).
    Any suggestions? The indexes are valid, syncing is up-to-date, optimizing has no errors,a nd there are token_counts for the tokens in the $I table for the text_a field.
    This problem has crossed into a second day and the same value of the 16th (as in the query above) is still used and still does not return rows. What else should I be looking at?
    In advance, thanks for any suggestions/assistance.
    - Jenny

    I believe the 1555 error is an obscure response to (i.e. a result of) another problem.
    The create_date column is a date datatype. The NLS format matches at the session, instance and database level (nls_session_parameters, and instance, and database). The NLS_DATE_FORMAT is set to YYYY-MM-DD"T"HH24:MI:SS"Z" in each of those views. Would this still cause a potential problem?
    I neglected to say that we are on version 9.2.0.7 (both the data dictionary and the binaries).
    The response from raford suggests that the optimizer is causing the text index to be called in "functional lookup" mode. I tried testing it, forcing it to use an index. The query ran in 3.5 minutes. Then I tested the original query and received the same results. After checking with the other DBAs, one of them was updating statistics on partitions for previous days' data. The statistics were only being run on current data partitions for the current day, but apparently the method that the application uses to "update" data (which could be for previous days) is to delete it and then insert it. I am suspecting that this is the root cause of all our evil! We are currently working with the developers to get this design changed. In the meantime, I REALLY appreciate all the help/suggestions. If we see the problem occur again, we will add the hint to test and verify whether or not that is the cause. I suspect it will be. Thank you raford.
    Darn that optimizer!!!! ;-)
    Oh, just a hint: Using set autotrace traceonly explain will NOT show that each of the text index partitions is being scanned. This was what we were using for our explain plans. But, when another query, with a similar problem, was finally run, we used EM and the "Long Ops" tab to finally see that each partition was being scanned for the token, whether it needed it or not. I think I'll go back to Tom Kyte's website and look for that article on the set autotrace traceonly explain not giving a totally accurate explain plan.
    Thanks again.
    - Jenny

  • Query works in Oracle Client but not JDBC

    The query is as follows:
    SELECT COUNT(*) THE_COUNT FROM sentorders WHERE ordersentdate BETWEEN '15-JAN-01' and '15-JAN-03';When I run this query in the Oracle client (SQL+) it tells me that THE_COUNT is 4 which is correct but when I use the following JDBC code I get THE_COUNT is 0 which is incorrect.
    public ResultSet viewTotalSentOrdersByDate()
      throws SQLException, Exception {
          String beginDate = "15-JAN-01";
          String endDate = "15-JAN-03";
          ResultSet rs = null;
        try  {
          String queryString = ("SELECT COUNT(*) THE_COUNT FROM sentorders WHERE ordersentdate BETWEEN '" + beginDate + "' and '" + endDate + "'");
          System.out.println(queryString);
          Statement stmt = con.createStatement();
          rs = stmt.executeQuery(queryString);
          while(rs.next()) {
           System.out.println(rs.getString("THE_COUNT"))
        } catch (SQLException sqle) {
          error = "SQLException: Could not execute the query.";
          throw new SQLException(error);
        } catch (Exception e) {
          error = "An exception occured.";
          throw new Exception(error);               
        return rs;
      }Thanks for the help
    Zac

    The query is as follows:
    SELECT COUNT(*) THE_COUNT FROM sentorders WHERE ordersentdate BETWEEN '15-JAN-01' and '15-JAN-03';When I run this query in the Oracle client (SQL+) it tells me that THE_COUNT is 4 which is correct but when I use the following JDBC code I get THE_COUNT is 0 which is incorrect.
    public ResultSet viewTotalSentOrdersByDate()
    throws SQLException, Exception {
    String beginDate = "15-JAN-01";
    String endDate = "15-JAN-03";
    ResultSet rs = null;
    try {
    String queryString = ("SELECT COUNT(*) THE_COUNT FROM sentorders WHERE ordersentdate BETWEEN '" + beginDate + "' and '" + endDate + "'");
    System.out.println(queryString);
    Statement stmt = con.createStatement();
    rs = stmt.executeQuery(queryString);
    while(rs.next()) {
    System.out.println(rs.getString("THE_COUNT"))
    } catch (SQLException sqle) {
    error = "SQLException: Could not execute the query.";
    throw new SQLException(error);
    } catch (Exception e) {
    error = "An exception occured.";
    throw new Exception(error);
    return rs;
    }Thanks for the help
    Zac

  • Form auto query works in 10g developer, but not when served by forms server

    I have a form with a master and two detail blocks on the same canvas. When I run it from the developer tool on my desktop, it works great, the master block populates as expected based on the GO_BLOCK and EXECUTE_QUERY statements, and the detail blocks both populate automatically, firing their POST_QUERY triggers as well. When I run it on the server, I have to execute query manually, and then navigate to each of the detail blocks and then execute their queries manually too. When I do that, their POST_QUERY triggers are not firing.
    Desktop is (Windows XP Professional version 5.1 build 2600.xpsp_sp3_gdr.100427-1636 : Service Pack 3)
    Developer version is Forms [32 Bit] Version 10.1.2.0.2 (Production)
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    Oracle Toolkit Version 10.1.2.0.2 (Production)
    PL/SQL Version 10.1.0.4.2 (Production)
    Oracle Procedure Builder V10.1.2.0.2 - Production
    PL/SQL Editor (c) WinMain Software (www.winmain.com), v1.0 (Production)
    Oracle Query Builder 10.1.2.0.2 - Production
    Oracle Virtual Graphics System Version 10.1.2.0.2 (Production)
    Oracle Tools GUI Utilities Version 10.1.2.0.2 (Production)
    Oracle Multimedia Version 10.1.2.0.2 (Production)
    Oracle Tools Integration Version 10.1.2.0.2 (Production)
    Oracle Tools Common Area Version 10.1.2.0.2
    Oracle CORE     10.1.0.4.0     Production
    Server version is OAS forms/reports install – 10.1.2.3
    OS – x86-64bit (Red Hat Enterprise Linux Server release 5.4)

    hello,
    does oracle showing any errors in user_scheduler_job_run_details for this job ? I would advise try inserting some debug statement to identify where exactly its stuck. Also please check sample configurations syntax for user_scheduler_jobs.
    Cheers
    Sush

  • IP - Issues with Input Query: Works on Bex analyzer but not on Web

    I am doing the following:
    Created a Aggregation level for a multi provider which has only real time infoproviders associated with it
    Created the query using Bex Query Designer availing all the options for planning
    When I execute this query it executes using a web template and does not open up the Key Figure cells for input, I had tried using the Web Application designer with Save button but still the same issue
    I tried the same on Bex analyzer and it works fine
    Please help to resolve the above issue.
    Thanks in advance.

    Hi Ram,
    Cells should be input enabled on the web just running the query. No need to create a Webtemplate, altough you need to have the webtemplate to be able to use the "save data" function.
    Maybe your query is not input ready at all, and you're misinterpreting analyzer layout.
    To test this, please enter some plan data in analyzer, right click and choose "save".
    Please check if data is written to the real time infoprovider.
    Hope this helps you.
    Regards,
    Miguel P.

  • Query works in Tera Term but not in Telnet Read.vi

    I am using Telnet Write.vi to execute a command such as GET_VERSION
    Then using Telnet Read.vi, I am expecting several lines to be returned.
    This works if I manually do this with Tera Term.
    But with LabVIEW, the Telnet Read.vi simply returns the command from the Telnet Write.vi
    What do I have to configure to change this behavior?

    Edit:
    Needed to add carriage return +  newline 
    DUH.

  • Same SQL Statement Works in Data Service but not in its Input Port

    Hi Experts,
    I am using this query in one of my data service. Test execute success which returned:
                                            E      U      H     M      L
    2     Less Than 1 Week     0     0     0     0     0
    3     1 - 2 weeks          0     0     0     0      0
    4     2 - 4weeks          0     0     0     0      0
    5     More Than 1 Month     0     0     6     0     0
    However, when i copy the same query to the input port, enclosing it with "[my query]"
    Deployed and run it. I get an "Unspecified Error" message box prompted in the iView, and null pointer exception error in the log file.
    #1.5 #001A64CA3F5600660000034400001140000487DBB6D27A4D#1275277641800#com.sap.portal.visualComposer_NWBIKit_logger#sap.com/irj#com.sap.portal.visualComposer_NWBIKit_logger#TOMAS004#89896##n/a##37c590906c6711df8503001a64ca3f56#SAPEngine_Application_Thread[impl:3]_32##0#0#Error#1#/System/Server#Java###null
    [EXCEPTION]
    #1#java.lang.NullPointerException
         at com.sap.portal.guimachine.bikit.query.relational.impl.BIRelationalQuerySql.processTemplateParams(BIRelationalQuerySql.java:40)
         at com.sap.portal.guimachine.bikit.query.relational.impl.BIRelationalQuerySql.<init>(BIRelationalQuerySql.java:31)
         at com.sap.portal.guimachine.bikit.query.relational.impl.BIRelationalFactory.newRelationalQuery(BIRelationalFactory.java:59)
    Any idea what is the mistake?
    Thanks in Advance,
    Sarah

    Hi Experts,
    I am using this query in one of my data service. Test execute success which returned:
                                            E      U      H     M      L
    2     Less Than 1 Week     0     0     0     0     0
    3     1 - 2 weeks          0     0     0     0      0
    4     2 - 4weeks          0     0     0     0      0
    5     More Than 1 Month     0     0     6     0     0
    However, when i copy the same query to the input port, enclosing it with "[my query]"
    Deployed and run it. I get an "Unspecified Error" message box prompted in the iView, and null pointer exception error in the log file.
    #1.5 #001A64CA3F5600660000034400001140000487DBB6D27A4D#1275277641800#com.sap.portal.visualComposer_NWBIKit_logger#sap.com/irj#com.sap.portal.visualComposer_NWBIKit_logger#TOMAS004#89896##n/a##37c590906c6711df8503001a64ca3f56#SAPEngine_Application_Thread[impl:3]_32##0#0#Error#1#/System/Server#Java###null
    [EXCEPTION]
    #1#java.lang.NullPointerException
         at com.sap.portal.guimachine.bikit.query.relational.impl.BIRelationalQuerySql.processTemplateParams(BIRelationalQuerySql.java:40)
         at com.sap.portal.guimachine.bikit.query.relational.impl.BIRelationalQuerySql.<init>(BIRelationalQuerySql.java:31)
         at com.sap.portal.guimachine.bikit.query.relational.impl.BIRelationalFactory.newRelationalQuery(BIRelationalFactory.java:59)
    Any idea what is the mistake?
    Thanks in Advance,
    Sarah

  • Generic working in eclipse compiler but not through builds

    The following code snippet works fine in my eclipse development environment (1.6.0_06), but the build system running 1.6.0_06 throws exception:
    MyClass:343: incompatible types
    found : java.util.List<C>
    required: java.util.List<B>
    entries = createListFromSmartCopy(myAList, new B(), true);
    Types:
    A is an interface
    B is an interface of A
    C is an implementation of B
    List<A> aList = new ArrayList<A>();
    aList.add(new A());
    List<B> return = createListFromSmartCopy(aList, new C(), true);
        * <p>Creates a copy of a list where the source list could be an ancestor
        * type of the returned list. It also uses a reference object to actually
        * construct the objects that populate the return list.</p>
        * @param <T> - The ancestor type of the source list
        * @param <R> - The derived type of the destination list
        * @param <S> - The more derived type of the prototype object used to
        * construct the list of R's
        * @param sourceList - The source list
        * @param referenceObject - The object used to construct the return list
        * @param deepCopy - Deep copy serializable objects instead of just copying
        * the reference
        * @return a list of R's (as defined by the caller) of entries with the
        * object constructed as a copy of referenceObject with the properties of the
        * sourceList copyied in after construction
    public static <T extends Serializable, R extends T, S extends R> List<R> createListFromSmartCopy(
                List<T> sourceList, S referenceObject, boolean deepCopy)
          List<R> retr = new ArrayList<R>();
          for(int i = 0; i < sourceList.size(); i++)
             retr.add(copyOf(referenceObject));
             copyInto(sourceList.get(i), retr.get(i), deepCopy);
          return retr;
       }Any thoughts on either:
    1. How does this pass the compiler validation inside eclipse, even through 'R' has not been defined? I believe that the code is doing some sort of return type inference to return the exactly correct type of list as referred by the return result or else it is simply ignoring the invariant capture of R all together and silently dropping the error. The funny thing is that the code does work just fine in practice in my development system without an issue.
    or
    2. Why if the code is valid does the independent build system disallow this generic return type 'inference' to occur? Are there compiler flags I can use to withhold this special condition?

    Thanks for the response, I wasn't trying to show a full example but just my implementation's snippet. I'll list one now:
    package test;
    import java.io.ByteArrayInputStream;
    import java.io.ByteArrayOutputStream;
    import java.io.IOException;
    import java.io.ObjectInputStream;
    import java.io.ObjectOutputStream;
    import java.io.Serializable;
    import java.util.ArrayList;
    import java.util.List;
    public class TestMe
        * <p>This method performs a deep copy of an object by serializing and
        * deserialzing the object in question.</p>
        * @param <T> - The type of data to copy
        * @param original - The original object to copy
        * @return The object who's state should be the same as the original. This
        * call uses serialization to guarantee this copy is fully separate from the
        * original, so all sub-object references are also deep copies of their
        * originals
       @SuppressWarnings("unchecked")
       public static <T extends Serializable> T clone(T original)
          T obj = null;
          try
             ByteArrayOutputStream bos = new ByteArrayOutputStream();
             ObjectOutputStream out = new ObjectOutputStream(bos);
             out.writeObject(original);
             out.flush();
             out.close();
             ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(
                      bos.toByteArray()));
             obj = (T)in.readObject();
          catch(IOException e)
             e.printStackTrace();
          catch(ClassNotFoundException cnfe)
             cnfe.printStackTrace();
          return obj;
        * <p>Copies the properties from one object to another. The destined object
        * in this method must be derived from the source object. This allows for a
        * faster and smoother transition.</p>
        * @param <T> The type of source
        * @param <R> The type of destination
        * @param source - The source object
        * @param destination - The destination object
        * @param deepCopy - Copies the reference objects instead of just passing
        * back the reference pointer reference
       public static <T, R extends T> void copyInto(T source, R destination,
                boolean deepCopy)
       // Stubbed because it links into a ton of unnecessary methods
        * <p>Copies the values of a list of an ancestor class into the values of
        * another list who's value is derived from the ancestor.</p>
        * @param <T> - The ancestor type of the source list
        * @param <R> - The derived type of the destination list
        * @param sourceList - The source list
        * @param destinationList - The destination list
        * @param deepCopy - Deep copy serializable objects instead of just copying
        * the reference
       public static <T, R extends T> void copyIntoList(List<T> sourceList,
                List<R> destinationList, boolean deepCopy)
          if(sourceList.size() > destinationList.size())
             throw new IllegalArgumentException(
                      "Cannot copy entire source set into destination list");
          for(int i = 0; i < sourceList.size(); i++)
             copyInto(sourceList.get(i), destinationList.get(i), deepCopy);
        * <p>Creates a copy of a list where the source list could be an ancestor
        * type of the returned list. It also uses a reference object to actually
        * construct the objects that populate the return list.</p>
        * @param <T> - The ancestor type of the source list
        * @param <R> - The derived type of the destination list
        * @param <S> - The more derived type of the prototype object used to
        * construct the list of R's
        * @param sourceList - The source list
        * @param referenceObject - The object used to construct the return list
        * @param deepCopy - Deep copy serializable objects instead of just copying
        * the reference
        * @return a list of R's (as defined by the caller) of entries with the
        * object constructed as a copy of referenceObject with the properties of the
        * sourceList copyied in after construction
       public static <T extends Serializable, R extends T, S extends R> List<R> createListFromSmartCopy(
                List<T> sourceList, S referenceObject, boolean deepCopy)
          List<R> retr = new ArrayList<R>();
          for(int i = 0; i < sourceList.size(); i++)
             retr.add(clone(referenceObject));
             copyInto(sourceList.get(i), retr.get(i), deepCopy);
          return retr;
       public static void main(String[] args)
          List<A> aList = new ArrayList<A>();
          aList.add(new AImpl());
          aList.add(new AImpl());
          List<B> bList = createListFromSmartCopy(aList, new C(), true);
          for(B bItem : bList)
             System.out.println("My String = "
                      + bItem.getString() + " and my number = " + bItem.getInt());
       public static interface A extends Serializable
          public void setString(String string);
          public String getString();
       public static class AImpl implements A
          private static final long serialVersionUID = 1L;
          @Override
          public void setString(String string)
          @Override
          public String getString()
             return null;
       public static interface B extends A
          public void setInt(int number);
          public String getInt();
       public static class C implements B
          private static final long serialVersionUID = 1L;
          public C()
          @Override
          public String getInt()
             return null;
          @Override
          public void setInt(int number)
          @Override
          public String getString()
             return null;
          @Override
          public void setString(String string)
    }In my eclipse (20090920-1017), this compiles and runs just fine. I stripped out the functional pieces that weren't pertinent to the discussion.

Maybe you are looking for