Results 1 to 2 of 2

Thread: Sql Query in Java for an Access Database Issue [Resolved]

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2001
    Location
    Montréal, Québec
    Posts
    195

    Sql Query in Java for an Access Database Issue [Resolved]

    Hi

    I have a home made program written in java and a database in access. Up to now everyting is working fine for all querys except one.

    When testing the query in microsoft access, everyting's allright. The query return what's expected. When using the same query within my java program, it behave diferently. Further tests away, I've found that the LIKE "*" clause don't work well (some others guys also have the same issue but with no clue to what might be the solution was given).

    Here's the query:

    SELECT TimeActs.EmployeeRefNum, FACTURABLE.HEURES_FACT, NON_FACTURABLE.HEURES_NON_FACT from TimeActs

    left join

    (SELECT TimeActs.EmployeeRefNum, SUM(TimeActs.Duration) AS HEURES_FACT

    FROM TimeActs, Customers, Employees


    WHERE TimeActs.CustomerRefNum = Customers.CustomerRefNum
    AND UCase(Customers.NAME) NOT LIKE "*" & "PROJECT" & "*"
    AND TimeActs.EmployeeRefNum = Employees.EmployeeRefNum
    GROUP BY TimeActs.EmployeeRefNum

    ) AS FACTURABLE ON TimeActs.EmployeeRefNum = FACTURABLE.EmployeeRefNum


    left join


    (SELECT TimeActs.EmployeeRefNum, SUM(TimeActs.Duration) AS HEURES_NON_FACT

    FROM TimeActs, Customers, Employees



    WHERE TimeActs.CustomerRefNum = Customers.CustomerRefNum
    AND UCase(Customers.NAME) LIKE "*" & "PROJECT" & "*"
    AND TimeActs.EmployeeRefNum = Employees.EmployeeRefNum
    GROUP BY TimeActs.EmployeeRefNum

    ) AS NON_FACTURABLE ON TimeActs.EmployeeRefNum = NON_FACTURABLE.EmployeeRefNum


    group by TimeActs.EmployeeRefNum, FACTURABLE.HEURES_FACT, NON_FACTURABLE.HEURES_NON_FACT;



    What the query's supposed to do is get all employes names, billable hours and non-billable hours. Like I said, in access, it work well. From java, the column employes names's working ok, the column FACTURABLE.HEURES_FACT contain the sum of (FACTURABLE.HEURES_FACT + NON_FACTURABLE.HEURES_NON_FACT) and the column NON_FACTURABLE.HEURES_NON_FACT is always empty.

    After modifying the "UCase(Customers.NAME) NOT LIKE "*" & "PROJECT" & "*"" clause with a known project I've figured out that this clause is not well interpreted. In fact all customer.NAME containing the word "PROJECT" are treated as they weren't thus containing a column with the sum of everyting and an emtpy column.

    Does someone had a similar issue? Know a work around? Know some incompatibility between java and access 2003? All informations will be very handy.

    Thks
    Last edited by Megistal; May 26th, 2006 at 01:43 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width