Problem ordring by Time (sql questio)

hi all ! I have this sql.
String sql = "Select citas.IdCita,citas.Hora,citas.Fecha,citas.Protocolo,citas.DNI,citas.Opcion," +
            "citas.Observacion,citas.Horaentrada, paciente.Nombres,paciente.Apellidos,paciente.Prescriptor," +
            "paciente.Mutua,sesiones.Sesigast,sesiones.Sesifaltantes,protocolo.Tipo FROM citas,paciente,sesiones," +
            "protocolo WHERE citas.Fecha=? AND protocolo.Tipo=? AND paciente.DNI=citas.DNI AND paciente.DNI=sesiones.DNI AND " +
            "sesiones.Protocolo=citas.Protocolo AND citas.Protocolo=protocolo.Nombre ORDER BY citas.Hora DESC";
            PreparedStatement pstmt = conexion.prepareStatement(sql);
            pstmt.setDate(1,fecha_cita);
            pstmt.setString(2,tipo);
            cdr=pstmt.executeQuery();
         return cdr;The problem is that the query is not ordering by the HORA wich is a time tag (its already defined as time in the DB).
What could it be ? Please this are one of the last bugs I have in my app.
Thanks !

1 08:00:00 00:00:00 Juan Manuel S�nchez Cu�llar 2 B�sico
2 10:00:00 00:00:00 Juan Manuel S�nchez Cu�llar 0 Lumbar
3 20:00:00 00:00:00 Juan Manuel S�nchez Cu�llar 0 Lumbar
4 15:15:00 00:00:00 Juan Manuel S�nchez Cu�llar 0 Lumbar
Its the same user as you can see because I have only 1 registered now...
the time you see its cita.Hora and the second its the arrival time (and will be different from 0:00:00 in most cases)
For ordering I need citas.Hora
Drugs ? nothing at all !

Similar Messages

  • Loading (point) features takes MapViewer 20 times sql exec time?

    I have a map which contains only one theme which shows 14500 point geometries stored in a table (accessed via a view). Rendering the map takes a long time, more than 22 secs. Looking at the log from MapViewer it seems like the sql execution time is not the problem, also in a sql editor the query is fast. Labeling and rendering is fast too. CPU is not very busy while rendering the map, memory usage is under 70 MB. The problem seems to be loading the features after executing the sql query.
    This is the logging:
    06/01/24 08:46:23 Tue Jan 24 08:46:23 CET 2006 DEBUG [oracle.sdovis.theme.pgtp] [ STOFFEN_INSTALLATIES ] sql exec time: 100ms, total time loading 14593 features: 21401ms.
    06/01/24 08:56:32 Tue Jan 24 08:56:32 CET 2006 INFO [oracle.sdovis.DBMapMaker] **** time spent on loading features: 21221ms.
    06/01/24 08:56:32 Tue Jan 24 08:56:32 CET 2006 FINEST [oracle.sdovis.RE] xfm: 0.0377536231884058 0.0 0.0 -0.0377536231884058 -2650.2018115942033 17432.848768115942
    06/01/24 08:56:33 Tue Jan 24 08:56:33 CET 2006 DEBUG [oracle.sdovis.VectorRenderer] time to render theme STOFFEN_INSTALLATIES with 14593 styled features: 951ms
    06/01/24 08:56:33 Tue Jan 24 08:56:33 CET 2006 DEBUG [oracle.sdovis.VectorRenderer] time to label theme STOFFEN_INSTALLATIES with 14593 styled features: 0ms
    06/01/24 08:56:33 Tue Jan 24 08:56:33 CET 2006 INFO [oracle.sdovis.DBMapMaker] **** time spent on rendering: 951ms
    06/01/24 08:56:33 Tue Jan 24 08:56:33 CET 2006 DEBUG [oracle.lbs.mapserver.core.MapperPool] freeMapper() begins...
    06/01/24 08:56:33 Tue Jan 24 08:56:33 CET 2006 DEBUG [oracle.lbs.mapserver.core.RealWorker] [RealWorker] preparation time: 0ms
    06/01/24 08:56:33 Tue Jan 24 08:56:33 CET 2006 DEBUG [oracle.lbs.mapserver.core.RealWorker] [RealWorker] querying/rendering time: 22182ms
    06/01/24 08:56:33 Tue Jan 24 08:56:33 CET 2006 DEBUG [oracle.lbs.mapserver.core.RealWorker] [RealWorker] packing time: 60ms
    06/01/24 08:56:33 Tue Jan 24 08:56:33 CET 2006 DEBUG [oracle.lbs.mapserver.core.RealWorker] [RealWorker] --------------- total time: 22242ms
    22 seconds is too long for our application. Does anyone know what could be wrong and what I could do to improve this?
    Thanks in advance,
    Ida

    22 secs seems too long.
    I tried something similar on old Sun Sparc (Ultra 60) machines. db on one Sun box, MV on another. Both on same local network.
    SQL> select count(1) from openls_dir_businesses where country_subdivision='MD' ;
    COUNT(1)
    24638
    No indexes, no other optimizations
    Fetching and rendering 24638 points took 19 secs or so.
    Fetch time 10 secs, render time 9 secs.
    Tue Jan 24 15:09:01 EST 2006 INFO [oracle.sdovis.DBMapMaker] **** time spent on loading features: 10741ms.
    Tue Jan 24 15:09:10 EST 2006 INFO [oracle.sdovis.DBMapMaker] **** time spent on rendering: 9083ms

  • SQL Developer Stability - Real Time SQL Monitoring

    I always get excited when a new release of SQL Developer comes out with all kinds of new features then I am quickly disappointed by the instability.
    The 2.1 Real Time SQL Monitoring is a great example. It has such great promise but it is not stable, the refresh doesn't work, if you scroll it wipes out the display so I have to exit and re-enter. Is anyone having more success with this tool than me? Are there Java Settings I need to consider? I already learned that if running the query in question from SQL Developer it has to be in an unshared workspace or SQL Monitor won't come up.
    Prior to going to native OCI connectivity my Connections Schema Tree was also very flaky, I work with huge delivered PeopleSoft HR Schemas most of the time.

    The file associations thing means you don't have access to the registry to associate file types. Probably connected to the Vista security model. Try registering the filetypes for use by sqldeveloper through explorer.
    This other problems generally means you don't have write access to the sqldeveloper system directory.

  • Oracle 11gR2 to SQL Server 2008 R2 - Problem executing SP on SQL server

    Hi,
    I have this problem: Executing a sp in SQL server from oracle
    --------------------ORACLE SP--------------------
    create or replace
    PROCEDURE DRIVER_SP
    AP IN OUT appl_param%ROWTYPE
    as
    v_sp_name varchar2(50);
    v_control_id number;
    val VARCHAR2(100);
    cur INTEGER;
    nr INTEGER;
    BEGIN
    v_sp_name := ap.MESSAGE_MISC_TEXT;
    v_control_id := ap.control_id;
    cur := DBMS_HS_PASSTHROUGH.OPEN_CURSOR@dblink_sqlserver;
    DBMS_HS_PASSTHROUGH.PARSE@dblink_sqlserver(cur, 'execute ' || v_sp_name || ' ' || to_char(v_control_id));
    LOOP
    nr := DBMS_HS_PASSTHROUGH.FETCH_ROW@dblink_sqlserver(cur);
    EXIT WHEN nr = 0;
    DBMS_HS_PASSTHROUGH.GET_VALUE@dblink_sqlserver(cur, 1, val);
    END LOOP;
    DBMS_HS_PASSTHROUGH.CLOSE_CURSOR@dblink_sqlserver(cur);
    driver_ap01_log_msg('Procedure returned: ' || val);
    commit;
    exception
    when others then
    driver_ap01_log_msg(sqlerrm);
    END DRIVER_SP;
    --------------------SQL Server SP-----------------------
    ALTER PROCEDURE [dbo].[PA01_SP]
    @control_id integer
    AS
    begin
    --update PA01
    --set infile_control_id = @control_id
    --insert into dbo.PA01LOG(msg) values('test')
    select 0
    end
    THE PROBLEM: Oracle SP calls SQL Server SP and any time I try to INSERT/UPDATE/DELETE (DML) within SQLServer SP it throws an exception on Oracle's end. Once I comment all DML code the proc runs fine.
    +"ORA-28511: lost RPC connection to heterogeneous remote agent using SID=ORA-28511: lost RPC connection to heterogeneous remote agent using SID=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=xxxxxxx)(PORT=1511))(CONNECT_DATA=(SID=dg4msql)))+
    +ORA-02063: preceding line from DBLINK_SQLSERVER"+
    Please help.
    Thanks

    Thanks for your response, it got me closer to my goal. I'm still facing one problem:
    Let me explain what I need to achieve
    Purpose
    Execute an Oracle stored procedure which in turn executes a stored procedure on remote SQLServer which updates local tables on that SQLServer.
    Observations
    The execution of both procedures completes successfully. However, an explicit COMMIT statement must be issued on the Oracle session which initiated the transaction before any data could be read from the SQLServer updated table.
    The following is test exercise for proof of concept.
    PL/SQL code
    declare
    out_arg integer;
    ret_val integer;
    begin
    out_arg := 0;
    ret_val := "dbo"."ZZZ_SP"@DBLINK_SQLSERVER(10, out_arg);
    dbms_output.put_line(to_char(out_arg));
    end;
    SQLServer code
    ALTER procedure [dbo].[ZZZ_SP] (@arg1 integer, @arg2 integer output)
    AS
    begin tran tran1
    insert into dbo.PA01LOG(msg) values('ddd')
    commit tran tran1
    set @arg2 = @arg1 * 100
    select -1
    GO
    I have put the Oracle gateway in Single_Site mode to avoid two phase commit. I want SQLServer to be able to run its own transaction management. I don't want Oracle to be responsible for completing the transactions which take place within SQLServer.
    I fear there might be a gap in my knowledge.
    Any ideas why I need to issue a COMMIT in Oracle session to release the lock from SQLServer table?
    Thanks

  • Pages 08 fonts- problems with Arial, Times New Roman - how do I repair them?

    Pages 08 fonts- problems with Arial, Times New Roman - how do I repair them?
    Using 10.6.8 on MacBook Pro
    Mikeaaa

    I am running Snow Leopard. Transferring the same texts to TextEdit has no problems, so this is a Pages problem, I think.  Corruption of Times New Roman and Arial fonts, I suspect, but where? and what do I do about it? I just need to be pointed to a source of advice, I think.
    Thanks
    Mikeaaa

  • Face time fades out and then tries to reconnect on new ipad retina display on WiFi.  Iphone 4s has no problem with face time from exact same location and same contact.  WiFi signal strong on both devices.  What gives?

    Face time fades out and then retries to connect (new Ipad Retina Display) on WiFi. Iphone 4s has no problem with face time from same location and same contact.  What gives?

    rdallas001 wrote:
    Is the router to small?
    Not necessarily, if you are using Facetime all the data goes through your WiFi router, your cable/DSL modem, your ISP and the internet to Apple's Facetime servers and then, in reverse, down to the Facetime recipient. If your ISP connection is too slow or there is excessive traffic on the internet you can have Facetime problems.
    Most WiFi routers can handle this unless others in the house are also using WiFi at the same time. The problem may be your ISP connection or congestion on the internet, etc.

  • I have problem with login in sql Server give me support .pre login handshake

    I have problem with login in sql Server give me support .pre login handshake

    The following threads are on the same topic:
    http://www.sql-server-performance.com/forum/threads/pre-login-handshake-error-when-connecting-to-db.687/
    http://stackoverflow.com/questions/12308340/sql-server-2000-connection-error-pre-login-handshake
    http://dbaspot.com/sqlserver-server/458011-error-occurred-during-pre-login-handshake-microsoft-sql-server-error-10054-a.html
    Kalman Toth Database & OLAP Architect
    IPAD SELECT Query Video Tutorial 3.5 Hours
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • I am having problems reestablishing my Time Capsule.  I had to get a new internet modem and that seemed to screw up my Time Capsule.  The amber light keeps blinking and it's not being picked up when my Macbook scans or when my PC scans for the wireless ne

    I can't find my Time Capsule on my networks anymore.  It's like it doesn't exist. We got hit by a storm and that might have caused our internet modem from ATT to fry.  I replaced the modem today but now my Time Capsule isnt working.  It's blinking amber.  The PC its connected to through the ATT modem isn't finding it as it scans and its not in utilities.  My MacBook isn't finding the time capsule either when it scans.  Whenever I hooked up all the wires to the time capsule and the modem, the internet stops working.  I've tried resetting the time capsule but it's still blinking.  I had all my computer equipment on a power surge protector. A pretty good one.  All my other equipment is fine.  The ATT modem was old, so I thought it might not have even been the lightening.  Nothing else in home was injured by storm.  I am freaking out and need help!!!  I can't use my MACbook to do my internet work and all my files were backed up on the time capsule. 
    Another problem. My Time Machine isn't backing up now either.  What is up with that? 
    I would be soooo grateful if someone can help me!  Thanks a million!

    A PC can have more issues connecting than a Mac.
    But it really should not matter.. so just try it in situ.. press and hold the reset.. once it starts up, it will return to default IP, 10.0.1.1 the PC should then be able to find it via the airport utility.
    If not drag it over to the Mac and plug in there by ethernet.. or since it is a laptop, really should not be that difficult to drag the Laptop and plug it into the TC.
    Important thing is to get access to the TC.
    The Mac if it is running lion, then you MUST download and install 5.6 airport utility to do anything useful.
    http://support.apple.com/kb/DL1482

  • I am having problems exporting my time lapses from quick time pro i need to save my files as photo jpegs but the standard video compression window will not open fully,

    i am having problems exporting my time lapses from quick time pro i need to save my files as photo jpegs but the standard video compression window will not open fully, it just keeps my mac (old 1.6Ghz 2.5 GB sdram G5 still good for most stuff i need) spinning for ever but i can see compression type H.264 selected and the other setting but i can not select any other options as it still thinking but never opens! why is this happening how do i get round it?
    my work flow is: 300 images shot on a 5d mark II medium jpegs opened in Light Room cropped to 16:9 then exported and opened in quick time i can save a .mov H264 giving me files sizes of 14 mb for a 16 second time lapse, mp4 9 mb. the only way i can get large files is saving as a self contained movie then i get 300mb files.
    i need to save my files 1920 x 1080 photo jpeg codec as i want HD quality.
    i am sure there is a simple way round this?
    thanks guys!

    It is very difficult to offer troubleshooting suggestions when the "os version" you are using is unknown as each os has their own troubleshooting solutions. 
    How large is your hard drive and how much hard drive space do you have left? 

  • I'm unable to open up Lightroom 5, I get this message in a pop up box: "Lightroom encountered an error when reading from it's preview cache and needs to quit" Underneath  that is "Lightroom will attempt to fix this problem the next time when it launches."

    I'm unable to open up Lightroom 5, I get this message in a pop up box: "Lightroom encountered an error when reading from it's preview cache and needs to quit" Underneath  that is "Lightroom will attempt to fix this problem the next time when it launches."  It hasn't, what should I do? Thanks Shawn (Irish Se7en) .

    Can you try to rename (not delete!) the folder named "YOUR_CATALOG_NAME Previews.lrdata" and restart Lightroom?

  • It says Lightroom encountered an error when reading from a previous cache and needs to quit. Light room will attempt to to fix the problem the next time it launches.

    how do i fix this. It says Lightroom encountered an error when reading from a previous cache and needs to quit. Light room will attempt to to fix the problem the next time it launches.

    Have a look at this thread.
    Lightroom encountered an error when reading from its preview cache and needs to quit.  Lightroom will attempt to fix this problem the next time it launches"."

  • Lightroom encountered an error when reading from its preview cache and needs to quit.  Says Lightromm will attempt to fix the problem the next time it launches, but on every re-launch I get the same message.  Any clue as to how to fix this problem?

    I recently updated my HP laptop's OS from WIndows8 to WIndows8.1.  When I went attempted to open Lightroom5 I got the following message:
    "Lightroom encountered an error when reading from its preview cache and needs to quit. "
    "Lightroom will attempt to fix the problem the next time it launches"
    Every time I relaunch I  get the same message.  I'd like to understand what might be causing the problem so I can remedy and get back to my photo editing. Any clue as to how to fix this problem would be greatly appreciated.
    JPM

    reset your preferences, Resetting (or 'Trashing') the Lightroom Preferences file - Lightroom Forums

  • Lightroom encountered an error when reading from its preview cache and needs to quit.  Lightroom will attempt to fix this problem the next time it launches"."

    Lightroom encountered an error when reading from its preview cache and needs to quit. Lightroom will attempt to fix this problem the next time it launches"."Help
    Please

    Stan Blumberg wrote:
    I have deleted the file but the message persists even after restarting the computer....any advice??...I am using LR 5
    You don't delete a file, you have to delete a folder. Is that what you did?
    If you deleted the folder specified above, and you still get the message, then it's the wrong folder. Use your operating system's search function and find ALL folders on ALL disks whose name ends with Previews.LRDATA, delete each one found, and then try opening Lightroom.

  • When I tried to open Lightroom 5.4 today I got a msg that says "Lightroom encountered an error when reading from its preview cache and needs to quit. Lightroom will attempt to fix this problem the next time it lauches". What do I do? I get the msg each ti

    "Lightroom encountered an error when reading from its preview cache and needs to quit. Lightroom will attempt to fix this problem the next time it lauches". What do I do? I get the msg each time I try to open it.

    It isn't a file, it's a folder. It will have the same name as your catalog, but will have the extension data. It will be in the same folder along with your catalog. If you need to use the search feature to search for *.lrdata.

  • Problem at the time of Goods receipt(MM)

    Dear all,
    I am new in MM and I am facing a problem at the time of goods receipt against subcontracting order. In our scenario we are create a subcontracting order for one finish material and in BOM we are giving some raw material. After that we are doing transfer posting (material provide to vendor) and then receive the finish goods.But at the time of goods receipt against SCO order I am getting error that multiple parent batch for finish batch. I am unable to understand the problem. so, kindly help me.
    Thanks
    Rahul.

    I think you are receing multiple bacthes for the parent material,In this case you need to select Distribute qty option in MIGO.Here you can split the qty batchwise for parent material.If you split the qty it will allow you to receive the material.

Maybe you are looking for