Variables expression in the JDBC. problems need help!

Dear Sir,
I am a beginner of using JDBC. I have a problem in the variable expression.
the fragment code is below
int today = 20041009;
ResultSet rs = statement.executeQuery("select * from recorder where bookeddate >= 'today' order by bookeddate");
I want to order the "booked date" and select the date after today. Unfortunately, it doesn't work. Any person can tell me how to add variable 'today' in to the SQL? I used mySQL
If this question is tooo stupid, please forgive me.
Thanks
Daan

Dear Sir,
I am a beginner of using JDBC. I have a problem in the
variable expression.
the fragment code is below
int today = 20041009;
ResultSet rs = statement.executeQuery("select * from
recorder where bookeddate >= 'today' order by
bookeddate");
I want to order the "booked date" and select the date
after today. Unfortunately, it doesn't work. Any
person can tell me how to add variable 'today' in to
the SQL? I used mySQL
If this question is tooo stupid, please forgive me.
what type of field is bookeddate.. a DATE or TIMESTAMP?
the format you have is a TIMESTAMP.
once you have solved the problem of actually including the variable in your query (as the previous poster mentioned) if you still have difficulty make sure you are using the right format for the given field.
you might well want to look at using prepared statements as well because they will handle the formatting for you.. you will need to convert your int variable today into an actual Date object though.

Similar Messages

  • HT4759 I've lost my iPhone & recently too, my laptop which I saved all my iCloud data has been reformatted. So now I hv problem to trace all the notes that I kept. I only managed to get my contacts and calendar,unfortunately not the NOTES. Need help..TQ

    I've lost my iPhone & recently too, my laptop which I saved all my iCloud data has been reformatted. So now I have problem to trace all the notes that I kept. I only managed to get my contacts and calendar,unfortunately not the NOTES. Need help how to retrieve my notes from the iCloud..TQ

    Lord K.  Thank you. Yes I am within the 90 time period, however I travel Intertionally and I can not receive not make a call to Apple. I was just at the Genius Bar in Chicago and they said, don't worry about it.  It just floats out there, however, I can not recover my messages on a flash drive. I need to go back to my old computer which I don't have with me.  My messages were in folders for a lawsuit.  It is going to take an incredible amount of work for me to, you have no Idea.  We are talking thousands of pages!  I the defendent will have them during discovery so I am not so worried.  However, I can not bring them to him on a Flashdrive when I meet with him without an extraordinary amount of presssure on my part.  THis is not just some little email issue. This is suing EXPEDIA and Tripadviosr.com

  • My screen is completely white, i've tried holding lock and home buttons as seen on you tube something called 'white screen of death' its goes black (think it switches off) then back to the white screen need help fast please!

    my screen is completely white, i've tried holding lock and home buttons as seen on you tube something called 'white screen of death' its goes black (think it switches off) then back to the white screen need help fast please!

    If you have not done a factory reset on the device, I recommend doing a complete  factory reset.  
    Factory Reset  - Warning this will reset device back to original factory settings.
    This method will not erase any MDN/MIN information
    Turn off the phone 
    Press Power + Volume Up/Down at the same time and hold until display will show a triage android screen 
    Display will show: 
    Reboot system Now 
    Apply sdcard:update.zip 
    Wipe Data/Factory Reset 
    Wipe Cache Partition
    Use VOL Down key to scroll down to "Wipe Data/Factory Reset", press home icon to select option and wipe device. 
    Display shows "All user data will be wiped out", press VOLUME Up to continue or VOLUME Down to exit. 
    Press Volume Up 
    Press Home to select "Reset System Now" - device will reboot
    If the problem persist I recommend having a store technician take a look at the device.
    Copy and paste the link below into your browser's address bar for the store locator.  
    http://www.verizonwireless.com/b2c/storelocator/index.jsp

  • I got new hard driver for my MacBook I don't have the cd but I do have flash drive that has the software I need help because when I turn on my laptop it shows me a file with question mark how can I install the software from the flash driver?

    I got new hard driver for my MacBook I don't have the cd but I do have flash drive that has the software I need help because when I turn on my laptop it shows me a file with question mark how can I install the software from the flash driver?

    Hold down the Option key while you boot your Mac. Then, it should show you a selection of devices. Click your flash drive and it will boot from that.

  • I have an itouch, most songs i got off my cd's. i have a new laptop and want to put songs from itouch to laptop.I can only get the songs that i purchased onto the laptop? need help with how to get the rest from itouch to laptop please??

    i have an itouch, most songs i got off my cd's. i have a new laptop and want to put songs from itouch to laptop.I can only get the songs that i purchased onto the laptop? need help with how to get the rest of the songs (from my cd's) from itouch to laptop please??

    See this previous discussion:
    Recovering your iTunes library from your iPod or iOS device: Apple Support Communities

  • Hi I am new on the Mac, I need help, how can I run my apps from my library on my Mac Pro?  All my apps I was used in my iPad, thanks guys!!!!

    Hi I am new on the Mac, I need help, how can I run my apps from my library on my Mac Pro?  All my apps I was used in my iPad, thanks guys!!!!

    The Mac OS X and iOS versions are separate products

  • Still stuck with the same old producer consumer weight problem need help

    Hello All,
    This is the problem I am stuck with right now.
    I have two array lists one producer array list and one consumer array list denoted by a and b
    P1 P2 P3 P4 P5
    5 6 7 8 9
    C1 C2 C3 C4 C5
    2 3 4 5 6
    Now we find all those producer consumer pairs which satisfy the criteria Pi>=Ci
    We have the following sets
    (5,2)(6,2)(7,2),(8,2),(9,2)
    (5,3)(6,3)(7,3),(8,3),(9,3)
    (5,4)(6,4)(7,4),(8,4),(9,4)
    (5,5)(6,5)(7,5),(8,5),(9,5)
    (6,6)(7,6)(8,6),(9,6)
    Let us done each of them with Si
    so we have S1,S2,S3,S4,S5
    we assign a third parameter called weight to each element in Si which has satisfied the condition Pi>=Ci;
    so we we will have
    (5,2,ai),(6,2,bi),(7,2,ci)....etc for S1
    similarly for S2 and so on.
    We need to find in each set Si the the pair which has the smallest weight.
    if we have (5,2,3) and (6,2,4) then 5,2,3 should be chosen.We should make sure that there is only one pair in every set which is finally chosen on the basis of weight.
    Suppose we get a pair (5,2,3) in S1 and (5,2,3) in S2 we should see that (5,2,3) is not used to compare to compare with any other elements in the same set S2,
    Finally we should arrive at the best element pair in each set.They should be non repeating in other sets.
    Given a problem
    P0 P1 P2 P3 P4
    9 5 2 2 8
    6 5 4 5 3
    C0 C1 C2 C3 C4
    we have So as (P0,C0) and (P4,C0)
    assuming that the one with the smaller index has lesser weight PO is selected.In the program I have used random weights.from set S1 we select the pair PO,CO
    S1 =(P0,C1),(P1,C1) and (P4,C1)
    since P0 and P4 are already used in previous set we dont use them for checking in S1 so we have (P1,C1) as best.
    S2=(P0,C2),(P1,C2) and (P4,C2) so we dont use P0,C2 and P1 and C2 because PO and P1 are already used in S1.
    So we choose P4,C2
    in S3 and S4 ae have (P0,C3),(P1,C3),(P4,C3) so we dont choose anything
    and same in S4 also.
    So answer is
    (P0,C0),(P1,C1) and (P4,C2).
    My program is trying to assign weights and I am trying to print the weights along with the sets.It doesnt work fine.I need help to write this program to do this.
    Thanks.
    Regards.
    NP
    What I have tried till now.
    I have one more question could you help me with this.
    I have an array list of this form.
    package mypackage1;
    import java.util.*;
    public class DD
    private  int P;
    private  int C;
    private int weight;
    public void set_p(int P1)
    P=P1;
    public void set_c(int C1)
    C=C1;
    public void set_weight(int W1)
    weight=W1;
    public int get_p()
    return P;
    public int get_c()
    return C;
    public int get_x()
    return weight;
    public static void main(String args[])
    ArrayList a=new ArrayList();
    ArrayList min_weights_int=new ArrayList();
    ArrayList rows=new ArrayList();
    ArrayList temp=new ArrayList();
    Hashtable h=new Hashtable();
    String v;
    int o=0;
    DD[] d=new DD[5];
    for(int i=0;i<4;i++)
    d=new DD();
    for(int i=0;i<4;i++)
    d[i].set_p(((int)(StrictMath.random()*10 + 1)));
    d[i].set_c((int)(StrictMath.random()*10 + 1));
    d[i].set_weight(0);
    System.out.println("Producers");
    for(int i=0;i<4;i++)
    System.out.println(d[i].get_p());
    System.out.println("Consumers");
    for(int i=0;i<4;i++)
    System.out.println(d[i].get_c());
    System.out.println("Weights");
    for(int i=0;i<4;i++)
    System.out.println(d[i].get_x());
    for(int i=0;i<4;i++ )
    int bi =d[i].get_c();
    ArrayList row=new ArrayList();
    for(int j=0;j<4;j++)
    if( d[j].get_p() >=bi)
    d[j].set_weight((int)(StrictMath.random()*10 + 1));
    row.add("(" + bi + "," + d[j].get_p() + "," +d[j].get_x() + ")");
    else
    d[j].set_weight(0);
    row.add("null");
    rows.add(row);
    System.out.println(rows);
    int f=0;
    for(Iterator p=rows.iterator();p.hasNext();)
    temp=(ArrayList)p.next();
    String S="S" +f;
    h.put(S,temp);
    String tt=new String();
    for(int j=0;j<4;j++)
    if(temp.get(j).toString() !="null")
    // System.out.println("In if loop");
    //System.out.println(temp.get(j).toString());
    String l=temp.get(j).toString();
    System.out.println(l);
    //System.out.println("Comma matches" + l.lastIndexOf(","));
    //System.out.println(min_weights);
    f++;
    for(Enumeration e=h.keys();e.hasMoreElements();)
    //System.out.println("I am here");
    int ii=0;
    int smallest=0;
    String key=(String)e.nextElement();
    System.out.println("key=" + key);
    temp=(ArrayList)h.get(key);
    System.out.println("Array List" + temp);
    for( int j=0;j<4;j++)
    String l=(temp.get(j).toString());
    if(l!="null")
    System.out.println("l=" +l);
    [\code]

    In your example you selected the pair with the greatest
    distance from the first set, and the pair with the least
    distance from the second. I don't see how the distance
    function was used.
    Also it's not clear to me that there is always a solution,
    and, if there is, whether consistently choosing the
    furthest or the closest pairs will always work.
    The most obvious approach is to systematically try
    all possibilities until the answer is reached, or there
    are no possibilities left. This means backtracking whenever
    a point is reached where you cannot continue. In this case
    backtrack one step and try another possibility at this
    step. After all possible choices of the previous step,
    backtrack one more step and so on.
    This seems rather involved, and it probably is.
    Interestingly, if you know Prolog, it is ridiculously
    easy because Prolog does all the backtracking for you.
    In Java, you can implement the algorithm in much the same
    way as Prolog implementations do it--keep a list of all the
    choice points and work through them until success or there
    are none left.
    If you do know Prolog, you could generate lots of random
    problems and see if there is always a solution.

  • Re: Having some problems with the 8350i. Need Help Please!

    Everyone I talk to hears echo's. I also don't get text messenges until sometimes a full day after they're sent. I wonder if our geographic area dictates why this is happening..  if you search the forum for "echo" there's quite a few people with the same problem. I'm in Florida.

    How are you receiving the sms manually?
    If your device is new, proceed to change the device. 
    If I help you with any inquire, thank you for click kudos in my post.
    If your issue has been solved, please mark the post was solved.

  • Unwanted pausing and freezing at the beginning - Flash player problem - Need help

    Hi everybody,
    I have got the following problem: the problem occurs especially on youtube.com.
    Every time when I open a video, the adobe flash player buffers the video a little bit and suddenly the grey line, which means the buffering on youtube video, stops. Then video plays only until the end of the grey buffer line. Then it freeze and I have to wait until 10-20 seconds until the grey line continues moving forward and at the same time the video continues to play.
    But I don't want to have that freezing problem at the beginning of each video.
    The important thing to know is: when I used a very old version of the flash player (the version 9 or 10) then every video on youtube worked very well without any freezing problems at the beginning
    What is the solution. Can you please help me?
    Here is what I have done so far:
    I updated my flash player to the latest version.
    My internet speed is very fast.
    When I click right on the youtube video screen in order to go to the settings: then I unchecked "active hardware acceleration, I changed the temporary storage limit to "unlimited".
    My global settings looks like the following: I checked "allow websites to save information on your computer" and "ask if a website wants to use a peer assisted network".
    My OS: Windows 7 (64)
    Current version of firefox, chrome and IE. I have the problem in every browser.
    In the attachment you can see 2 screenshots of my problem: One where you can see the grey buffer line. and the 2nd: where you can see that the video stopped loading and buffering and the video stopped playing.
    Unfortunately, I don't get money from the company for advertising its product *sigh*. ;-)

    Just because your internet connection is fast doesn't mean that the route from the specific server to you is also equivalently fast.  You can get some additional information by right-clicking the YouTube video and choosing Stats for nerds.  That information would be interesting.
    If video plays back fine once it actually buffers successfully, then there's probably not a lot you can do.  You might take a look at a different browser.  Google Chrome will probably use HTML5 playback on YouTube, and Internet Explorer will use the ActiveX control on Flash, which is significantly different from the NPAPI Flash Player used in Firefox.

  • G5 DVI to VGA Dell Monitor Connection problems, need help!!!!!!!!!!!!!!!!!!

    hello,
    I'm running two dell monitors both of which were connected via DVI to my g5 quad dual dvi. My tv broke and I'm using one of my monitors to connect the cable boxes HDMI input to the dells DVI input, it works great.
    My problem is that i still want to run two monitors from my mac and still be able to switch channel sources from the Dells source button allowing me to switch from TV to Mac. Since I took up the dvi port on one of my monitors to connect to the cable box via HDMI, I have a free DVI cable. I purchased a tiny converter that allowed to change one end of the free DVI cable to VGA. I used this method to connect the cable to my g5's dvi port and the configured end to the VGA port on the monitor with no luck.
    The Dell monitor does not pick up any signal and just goes to sleep as if my computer does not exist. The TV works fine and I'm able to switch sources. Please note that I'm not using the DVI-VGA adaptor that came with my g5 and don't know if this would make a difference. If it does, how do i set this up because this adaptor is like 5 inches long.
    Does the adaptors DVI end need to be connected to the back of the g5 or does the VGA end need to be connected to the monitor or does it not matter. I need a longer dvi-vga cable as well, do they make them. This all depends if the problem actually is that that I'm not using the DVI-VGA cable that came with my mac to connect to the monitor in the first place.
    Can anyone help me out here. I'm using the Dell 2208WFP Ultra Sharp.

    Bad adapter?
    The G5 ports are DVI-I. Any good DVI-I to VGA adapter should be fine.

  • Zen Vision:M problem, NEED HELP!

    My zen vision:m is starting to run slowly. It started right after my player froze and i reset it.Now its really slow and barely even switches screens sometimes.Right now its just a black screen with the keypad lit up.Whats wrong with it'sI NEED HELP!

    johnnnyp wrote:
    hi, i have a problem with my creative vision m. i wanted to watch a movie and it froze. i tried to shut it down but it wouldnt respond, and now is frozen. please help me if you can!
    You know its kinda rude to derail XBenzinoFla thread with your own problems, make your own thread next time.
    But to the both of you especially XBenzinoFla, try putting your ZVM in rescue mode and run scan disk to see if it hel
    ps.

  • Zen Micro problem need help

    Today i was listening to music and my zen micro just froze while playing and no buttons could be pressed and the lock button wasnt on. So i took the battery out and rebooted the player but it froze at the creative screen. I went home and i went to recovery mode and tried to reload the firmware but it said erasing firmware for more than 2 hours. So then i tried a format but it said formating for the same amount of time. I need help please. Also, recently i've had problems witht the headphone jack. When ever i would stick it in it would sound distorted and i would have to move it around until i got it to a certain spot to hear it good again. If anyone else has this problem please tell me. One more thing i had returned my other micro zen in for hard dri've probems and this was my new one do u think if i have to return in (hopefully not) that they would accept it.

    If the functions in Rescue Mode aren't working properly then you need to contact Creative Support.

  • Does the JDBC driver need to changin when moving Oracle 9i to Oracle 11g??

    Hi All,
    I have two cases
    Case 1:
    Application is deployed on WebLogic 10 (JDK 5) and connects to Oracle 9i database using the thin driver. Now the database is now moving from ORacle 9i to Oracle 11g. I have the following question:
    1. Does the driver jar file and/or driver class need to be changed on the connection pool front?
    2. If yes then, do we need to change any of the jdbc coding to ensure compatibility?
    Case 2:
    Application is deployed on WebLogic 8.1 (JDK 1.4) and connects to Oracle 10g database using the thin driver. Now the database is now moving from ORacle 10g to Oracle 11g and application is moving to WebLogic 10. I have the following question:
    1. Does the driver jar file and/or driver class need to be changed on the connection pool front?
    2. If yes then, do we need to change any of the jdbc coding to ensure compatibility?
    Additioanlly, are there any other factors that I need to consider when upgrading these applications. Does any one have checklists?
    Any help will be really helpful.
    Thank you
    Nikhil

    nikhil.gonsalves wrote:
    Case 1:
    Application is deployed on WebLogic 10 (JDK 5) and connects to Oracle 9i database using the thin driver. Now the database is now moving from ORacle 9i to Oracle 11g. I have the following question:
    1. Does the driver jar file and/or driver class need to be changed on the connection pool front?Advised to do so (bugfixes, possible performance optimisations), not required unless you want to use functionality the 9i driver doesn't support.
    2. If yes then, do we need to change any of the jdbc coding to ensure compatibility?
    Not unless you want to use things not supported by the old driver.
    It is however a very good idea to at least update the name of the driver class, as the name used for the 9i driver has been deprecated (it's still allowed, but now leads to another method call which is a waste of CPU time).
    Case 2:
    Application is deployed on WebLogic 8.1 (JDK 1.4) and connects to Oracle 10g database using the thin driver. Now the database is now moving from ORacle 10g to Oracle 11g and application is moving to WebLogic 10. I have the following question:
    1. Does the driver jar file and/or driver class need to be changed on the connection pool front?See above.
    2. If yes then, do we need to change any of the jdbc coding to ensure compatibility?
    See above (except for the driver class name which you should have used the new name already had the application been written to make use of the new name which was introduced in 10g).
    Additioanlly, are there any other factors that I need to consider when upgrading these applications. Does any one have checklists?
    You should always do a full regression test of your entire platform when attempting a migration like this.
    Worst example of what can go wrong I ever encountered was an application where an upgrade of the database server it ran on led to a bugged batch job that for 5 years had (unnoticed to anyone) never completed because it always entered a timeout causing a rollback now suddenly no longer timing out and inserting 10k records of corrupt data every time it was run (where what it should insert were maybe a few dozen records of actual data at most).
    The database engine upgrade had not been announced to the dev team, the team responsible for it didn't do regression tests (as application testing is the responsibility of the dev team), the sys admins who should make full backups at upgrade moments (so we could roll back to the previous release if something went wrong) made no backup because it was no application upgrade, and now one of the core applications for several dozen offices was fundamentally broken.
    Technical lead for the application was literally on the other side of the world on a vacation, functional lead had left the company, the entire dev team consisted of me as a contractor brought in just 2 weeks prior and a new functional lead who'd arrived at about the same time, we were both still trying to get to know the system.
    Potential financial loss: millions a week if it wasn't fixed quick.
    That's the nightmare scenario from hell of course, where everything that could go wrong did go wrong all at the same time.

  • Query problem - need help

    Hi everyone,
    I need some help from you because before I update my View Object I need to know one value using a Query like this: SELECT cp FROM cpostais WHERE cp4=1234 AND cp3 = 123. The result of the Query I need to save it on a variable (let's call CP) so I can use it to update my View Object. Something like this: currentRow.setAttribute("CPostal", CP);
    I'm using JDeveloper 10.1.2, struts and UIX pages.
    Can anyone tell me how can I do this? I need an example or a tutorial.
    This is really importante, can anyone help me??
    Thanks,
    Atena
    Message was edited by:
    Atena

    I tried to use something like this:
    ViewObject thirdView = daContext.getBindingContext().getDefaultDataControl().getApplicationModule().findViewObject("S2CodigosPostaisView1");
    thirdView.setWhereClauseParam(0, currentRow1.getAttribute("Localidade"));
    thirdView.setWhereClauseParam(1, currentRow1.getAttribute("Cp"));
    thirdView.setWhereClauseParam(2, currentRow1.getAttribute("Ext"));
    thirdView.executeQuery();
    Row currentRow3 = thirdView.getCurrentRow();
    currentRow3.getAttribute("Id");
    But this is not working. :(
    Can anyone help me with this????
    Thanks,
    Atena
    Message was edited by:
    Atena

  • Ipod problem NEED HELP ASAP

    Hello guys,my ipod touch has battery problems and internal speaker are not working and will apple replace me a new one,i even have 1 year warranty and i want a new ipod touch white instead of black<<<plz plz plz reply ASAP plz really need HELP!THANK YOU

    If you iPod is defective, in warranty and not abused Apple will replace it with a refurbished one.  They may or may not replace it with the white one.  You will have to ask.
    Other users have asked the same question but I hav never heard them come back with whether or not they go the color changed.

Maybe you are looking for

  • MacBook Pro odd display issue, won't run anymore

    This is a 2006 MacBook Pro 15" A1211  Intel core 2 duo 2.16 model.  Diagnostics says nothing is wrong.  The computer is no longer functional as it won't go beyond this screen.  Any ideas what failed on this?    Initially the odd video pattern was int

  • Howto use user defined object in where clausel

    i create a user defined object adm_t SQL> desc adm_t Name Null? Type USER_ID NUMBER(38) STATUS NUMBER(38) DATUM DATE then i create a table test create table test admin adm_t; There is no problem to insert or select the data, but i don't know howto us

  • Can't view smart collections on a different computer

    I've generated about a dozen smart collections from photos on an external drive. This was done on my laptop. When I try to view the smart collections with the drive mounted to my desktop, I get the error message "collection target folder cannot be fo

  • When downloading music, the track sequence is not maintained in my itunes library.  How to arrange tracks to match original album?

    When downloading music from itunes, the track sequence is not maintained in my music library as in the original album sequence.  How to rearrange my itunes library track sequence to match that of the original album?  Thanks.

  • Stopping Services Error, huh?

    This is the message I get when trying to intall latest version: Service 'iPod Service' (iPodService) could not be stopped. Verify you have sufficient privilges to stop system services Any recommendations?   Windows XP     Windows XP