WHAT'S GOING ON!!!? JDBC Statement Problems

Sorry about the 2 previous posts, I kept getting an error when I tried to submit my thread saying that it could not be posted, but obviously it could!!
Anyway can anyone help me? One of my JSP's refuses to execute properly so I presume there is something wrong with the associated methods in my connector.java file. Everytime I try and run my JSP in TomCat it produces the error message "java.sql.SQLException: java.sql.SQLException: General error, message from server: "Table 'talboothdb.roomsoccupied' doesn't exist". The MySQL statements I am using work fine when typed directly into MySQL via the Command Prompt so I know they arn't the problem. Can anyone see where I am going wrong?
The neccessary connector java and the JSP I am using are displayed below,
package javaclass;
import java.sql.*;
import java.util.*;
public class connector{
  String error;
  Connection con;
  ResultSet rs = null;
  int success;
  public connector()   { }
  public void connect() throws ClassNotFoundException,
                           SQLException,
                           Exception {
       try
            Class.forName("org.gjt.mm.mysql.Driver").newInstance();
            con = DriverManager.getConnection(
                 "jdbc:mysql://localhost:3306/talboothdb","","");
            } catch (ClassNotFoundException cnfe) {
                 error = "ClassNotFoundException: could not locate DB driver";
                 throw new ClassNotFoundException(error);
            } catch (SQLException cnfe) {
                 error = "SQL Exception: Could not connect to database.";
                 throw new SQLException(error);
            } catch (Exception e) {
                 error = "Exception: An unknown error occured while connecting to DB";
                 throw new Exception(error);
       public void disconnect() throws SQLException {
            try {
                 if ( con != null ) {
                      con.close();
            } catch (SQLException sqle) {
                 error = ("SQLException: unable to close the DB connection");
                 throw new SQLException(error);
public void roomsBooked(String arrivalDate, String departureDate)
                              throws SQLException, Exception {
            if (con != null) {
              try {
                PreparedStatement checkBookings;
                checkBookings = con.prepareStatement
                     ( "CREATE TEMPORARY TABLE roomsoccupied "
                    + "SELECT roombooked.room_id FROM roombooked, booking "
                    + "WHERE "
                    + "roombooked.booking_id = booking.booking_id "
                    + "AND "
                    + "booking.arrival_date <  '?' "
                    + "AND "
                    + "booking.departure_date >  '?' "
                checkBookings.setString(1, departureDate);
                checkBookings.setString(2, arrivalDate);
                checkBookings.executeUpdate();
              } catch (SQLException sqle) {
                error = ""+sqle;
                throw new SQLException(error);
            } else {
              error = "Exception: Connection to database was lost.";
              throw new Exception(error);
     public ResultSet roomsAvailable()
                              throws SQLException, Exception {
            if (con != null) {
              try {
                PreparedStatement checkAvailability;
                checkAvailability = con.prepareStatement
                     ( "SELECT rooms.room_no FROM rooms "
                    + "LEFT JOIN roomsoccupied ON rooms.room_no=roomsoccupied.room_id "
                    + "WHERE roomsoccupied.room_id IS NULL;"
                checkAvailability.executeQuery();
              } catch (SQLException sqle) {
                error = ""+sqle;
                throw new SQLException(error);
            } else {
              error = "Exception: Connection to database was lost.";
              throw new Exception(error);
         return rs;
<%@ page language="java"
    import="java.sql.*, java.io.*, java.util.*
     " errorPage="error.jsp" %>
<jsp:useBean id="javaBean" class="javaclass.connector" />
<html>
<head></head>
<body>
<%
      javaBean.connect();
      String arrivalDate =  request.getParameter("ArrivalDate");
      String departureDate =  request.getParameter("DepartureDate");
      ResultSet rs = javaBean.roomsAvailable();
      while(rs.next())
      {  %> Room number <%= rs.getString(1) %>
       <P><% }
      javaBean.disconnect();
%>
</body>
</html>

Cross-posted every which way from Sunday:
http://forum.java.sun.com/thread.jsp?thread=498755&forum=48&message=2355311
http://forum.java.sun.com/thread.jsp?thread=498751&forum=54&message=2355294
http://forum.java.sun.com/thread.jsp?thread=498747&forum=48&message=2355272
http://forum.java.sun.com/thread.jsp?thread=498746&forum=48&message=2355270
http://forum.java.sun.com/thread.jsp?thread=497689&forum=54&message=2350463
bluey_the_punch, why are you so wedded to this CREATE TEMPORARY TABLE? In an earlier thread it was recommended that you see if this can be managed with a JOIN. Did you at least try it?
I see you added PreparedStatement, but you didn't implement it correctly. You certainly don't need to put single quotes around the question marks in the SQL. I'd also recommend that you make those columns dates in your database and use setDate() to bind the values. Strings compare much differently than dates do. If you're not getting the expected results, that might be why.
It just looks like you've blown off the advice you've gotten so far and just keep asking the same question in hope of getting the answer you want to hear. JMO - MOD

Similar Messages

  • Album Art Madness! What's Going On? Thumnails Problems

    1) I added album at to all of my tracks in my 'music folder' using itunes
    2) Used Doug's AppleScrips for Itunes to embed the artwork
    3) The icon on my music files changed from the itunes default grey background with a music note to display the album art when browsing my music files in finder
    4) I copied my music folder with embedded artwork to my external HD as a backup
    Every piece of software i've tried - itunes, traktor pro, songbird, vlc, media monkey (bootcamp), tag&rename (bootcamp) shows that the album art is with the file.
    Yet...
    1) If I copy tracks from my music folder to another location such as the desktop the file icon no longer dispays the album art on the icon - it is replaced by the grey itunes icon with the musical note.
    2) If I rename tracks in my music folder the file icon no longer dispays the album art on the icon - it is replaced by the grey itunes icon with the musical note.
    3) The backup I made on external HD no longer displays the embedded album art in the file icon
    Despite this the music file seems to have the artwork attached to it when launched in the mentioned music software.
    I have recently upgraded from leopard to snow leopard + the latest Itunes. Could it be a problem with preview? I really don't know what's going on, if my art really is embedded or what to do.
    Hope You Can Help!
    Thanks

    1) I added album at to all of my tracks in my 'music folder' using itunes
    2) Used Doug's AppleScrips for Itunes to embed the artwork
    3) The icon on my music files changed from the itunes default grey background with a music note to display the album art when browsing my music files in finder
    4) I copied my music folder with embedded artwork to my external HD as a backup
    Every piece of software i've tried - itunes, traktor pro, songbird, vlc, media monkey (bootcamp), tag&rename (bootcamp) shows that the album art is with the file.
    Yet...
    1) If I copy tracks from my music folder to another location such as the desktop the file icon no longer dispays the album art on the icon - it is replaced by the grey itunes icon with the musical note.
    2) If I rename tracks in my music folder the file icon no longer dispays the album art on the icon - it is replaced by the grey itunes icon with the musical note.
    3) The backup I made on external HD no longer displays the embedded album art in the file icon
    Despite this the music file seems to have the artwork attached to it when launched in the mentioned music software.
    I have recently upgraded from leopard to snow leopard + the latest Itunes. Could it be a problem with preview? I really don't know what's going on, if my art really is embedded or what to do.
    Hope You Can Help!
    Thanks

  • Safari only loads pages if I refresh each time. What is going on? Loading problem

    Currently I had to refresh every single page to post this question.
    My Safari 5.1.2 is not loading pages correctly. I click on a link or enter in a url to go to any website and Safari goes and tries to obtain waht I asked for, but stops loading after 60-80% is done (based on loading items on bottom info bar). I wait for another 120 seconds, and still nothing.
    I hit the stop loading button and press refresh and the page loads automatically perfect. This is frustrating to use right now, and I do not have any other browsers to try anything else on. Why am I having this problem?

    Delete the cache lately?
    Quit Safari.
    Go to ~/Library/Caches/com.apple.Safari.
    Move the Cache.db from the com.apple.Safari folder file to the Trash.
    Relaunch Safari.
    If that didn't help, from the Safari menu bar click Safari > Reset Safari
    Select the top 5 boxes, click Reset.
    BTW, if Safari isn't working at all, having a backup browser installed can help. If you need to re download Safari or support files you can.
    Google Chrome
    Mozilla Firefox Web Browser

  • Hello, i have received an ipad and it is not going to well. i will be charging it for 5  hours and when i unplug it, it says it is still not charged. anybody know what is going on?

    hello, i have received an ipad and it is not going to well. i will be charging it for 5  hours and when i unplug it, it says it is still not charged. anybody know what is going on?

    Same problem for me.
    1. Cannot connect to wifi as icloud password pop up keeps appearing.
    2. tried deleting account. UNable to do so.
    3. tried resetting password by logging into apple id through desktop as mentioned in one of the responses in another thread. Unfortunately the apple id to be reset is the same as being prompted by icloud and hence unable to reset the same.
    Feel like breaking the **** ipad into bits. Stupid of apple to let such a bug in and not offer support !!

  • My Apple TV keeps turning off in the middle of set-up.  What is going on?

    I have been trying to set-up my Apple TV and everytime I get almost finished typing in my homeshare information the TV screen goes blank and the Apple TV wont restart for 10 or 15 minutes.  What is going on?

    Intermittent problems are often a result of interference. Interference can be caused by other networks in the neighbourhood or from household electrical items.
    You can download and install iStumbler (NetStumbler for windows users) to help you see which channels are used by neighbouring networks so that you can avoid them, but iStumbler will not see household items.
    Refer to your router manual for instructions on changing your wifi channel or adjusting your multicast rate.
    There are other types of problems that can affect networks, but this is by far the most common, hence worth mentioning first. Networks that have inherent issues can be seen to work differently with different versions of the same software. You might also try moving the Apple TV away from other electrical equipment.

  • Ok, I have deleted EVERYTHING off my 16gb ipad. Photos, music, apps. All I have are the standard apps. It says I have used 11gb and only have 1.6 left. When I first bought it I had up to 4 movies and lots of apps, no problems. What's going on please!?

    Ok, I have deleted EVERYTHING off my 16gb ipad. Photos, music, apps. All I have are the standard apps. It says I have used 11gb and only have 1.6 left. When I first bought it I had up to 4 movies and lots of apps, no problems. What's going on please!?

    How much space is used by your Other? You may be able to reduce.
    How Do I Get Rid Of The “Other” Data Stored On My iPad Or iPhone?
    http://tinyurl.com/85w6xwn
    With an iOS device, the “Other” space in iTunes is used to store things like documents, settings, caches, and a few other important items. If you sync lots of documents to apps like GoodReader, DropCopy, or anything else that reads external files, your storage use can skyrocket. With iOS 5/6, you can see exactly which applications are taking up the most space. Just head to Settings > General > Usage, and tap the button labeled Show All Apps. The storage section will show you the app and how much storage space it is taking up. Tap on the app name to get a description of the additional storage space being used by the app’s documents and data. You can remove the storage-hogging application and all of its data directly from this screen, or manually remove the data by opening the app. Some applications, especially those designed by Apple, will allow you to remove stored data by swiping from left to right on the item to reveal a Delete button.
     Cheers, Tom

  • Safari problem:  when I switch back into safari from another application, the menu bar comes up but no tabs or windows.  What's going on?  Just started yesterday.  I have found a workaround: when I Command Tab back to safari, I hit command T to open a new

    Safari problem:  when I switch back into safari from another application, the menu bar comes up but no tabs or windows.  What's going on?  Just started yesterday.  I have found a workaround: when I Command Tab back to safari, I hit command T to open a new tab and Command W to close it, and my other tabs are visible.
    I have tried shutting down, closing tabs, with no success.  What's going on and how can I fix it?
    Thanks,
    Cindi B
    PS:  I'm not sure of the actual OS level, but I have not allowed it to upgrade to Maverick yet; concerned about it because of a few things I've read...

    A Safari extension or third party plugin may be causing the menu bar issue.
    From the Safari menu bar click Safari > Preferences then select the Extensions tab. Turn that OFF, quit and relaunch Safari to test. If that helped, turn one extension on then quit and relaunch Safari to test until you find the incompatible extension then click uninstall.
    If it's not an extensions issue, try troubleshooting third party plug-ins.
    Back to Safari > Preferences. This time select the Security tab. Deselect:  Allow plug-ins. Quit and relaunch Safari to test.
    If that made a difference, instructions for troubleshooting plugins here.
    As for which OS X is installed.
    Click the Apple () menu top left in your screen. From the drop down menu click About This Mac.
    The version is noted there.
    v10.6 Snow Leopard v10.7 Lion  v10.8 Mountain Lion
    It's your choice whether or not to upgrade to Mavericks. If you decide to do this, make sure your Mac meets the requirements noted here.

  • What is going on with 6.0.2 exchanged two phones today in store all with battery draining issue problem

    Guys, what is going on two phones exchanged in store today all had battery draining problems once phone updated to iOS 6.0.2.
    First phone wouldn't last 3 hours usage even in plane mode function.
    Second phone bit better battery life 3 hours 15 minutes usage No Apps installed on both phone and location turn off even setup as new phone.

    First of all, why did you say yes to Nero Back up before researching what it does with files already on the HDD? When I install Nero, the Back Up is the first thing I disable, it is a nagging pain, there are much better backup programs available. There are several file recovery programs out there to recover deleted files, that is, if that is what happened. Also, if you haven't overwritten the files, so you should be able to find them.

  • In IOS7 none of my YouTube movies show up on my site build with iWeb and its YouTube widget. On an iPad running IOS6 the site still works fine, and all movies play well. What is going on,and what can I do to solve this problem ???

    In IOS7 none of my YouTube movies show up on my site build with iWeb and its YouTube widget. On an iPad running IOS6 the site still works fine, and all movies play well. What is going on,and what can I do to solve this problem ???

    It's only Safari/iOS7. Chrome iOS7 works fine.
    Solution?
    Go to YT and grab the code.
    Paste it in a HTML Snippet.

  • I have a problem with iphoto (have a mac book pro): the icon in the dock appears with a question mark, and the application is gone!!! Can someone tell what's going on? Yesterday I had the same problem with itunes

    I have a problem with iphoto (have a mac book pro): the icon in the dock appears with a question mark, and the application is gone!!! Can someone tell what's going on? Yesterday I had the same problem with itunes: I downloaded the last version (it's free), but I cannot do the same with iphoto, and more important: I need to know what is happening!!! Please help me!

    Applications should not disappear all by themselves.
    If they are then that coud indicate serious problems with your hard drive.
    Backup everything up as quickly as possible.
    Using Disk Utility verify your system disk.
    Allan

  • When trying to print, adobe reader 11.0.07 keeps "Not responding" for 2 - 5 minutes before finally working? I have tried uninstalling and re-installing but same problem. What is going on? I have windows 7

    When trying to print, adobe reader 11.0.07 keeps "Not responding" for 2 - 5 minutes before finally working? I have tried uninstalling and re-installing but same problem. What is going on? I have windows 7

    First of all, why did you say yes to Nero Back up before researching what it does with files already on the HDD? When I install Nero, the Back Up is the first thing I disable, it is a nagging pain, there are much better backup programs available. There are several file recovery programs out there to recover deleted files, that is, if that is what happened. Also, if you haven't overwritten the files, so you should be able to find them.

  • HT1379 My computer I-mac is running super slow.  If I zap the PRAM it goes back to running well , briefly... a few hours, then back to super slow.  What is the resolution for this problem?  I have a Time machine that does back up well.

    My computer is running super slow.  I can correct the problem briefly by zapping the PRAM but is resumes as a problem after a few hours.  I have good time machine (capusle) backup daily.  I have done a disk verify and there doesn't appear to be anything wrong there.
    Help, this is wasting a lot of time to do simple functions.

    Hard to say what's going wrong without more information. Try the troubleshooting steps in my Mac Performance Guide. Post back if you need help with any of that or questions about the results.

  • I purchased a Shakira movie (HD). I watch it OK in my PC, but when trying to watch it in my TV using Apple TV I get an endless rolling wheel. I can watch other Apple Store movies with no problem. Any ideas of what's going on?

    I purchased a Shakira movie (HD). I watch it OK in my PC, but when trying to watch it in my TV using Apple TV I get an endless rolling wheel. I can watch other Apple Store movies with no problem. Any idea of what's going on?

    Welcome to the Apple Community.
    Try repopulating iTunes with the problematic files.

  • I am having problems opening images renerated in lightroom5 into cs6. Cs6 bridge does not see the lightroom libarary. If I open lightroom and right clik the image, edit in cs6, 6 opens but the picture doesnot follow. What is going on? Give me a hand.

    I am having problems opening images renerated in lightroom5 into cs6. Cs6 bridge does not see the lightroom libarary. If I open lightroom and right clik the image, edit in cs6, 6 opens but the picture doesnot follow. What is going on? Give me a hand, thanks.

    What edition of LR 5? What edition of ACR does PSCS 6 contain. If they are not parallel (same edition number x in [5 or 8].x ), is LR making a tiff or psd rendition of the image?

  • HT1386 Sry for disturbing, but i would to ask that how to overcome the problem of synchronising ? Itune showing me that the sync session is failed to start with my Ipad mini. Any ideas about what is going on ?

    Sry for disturbing, but i would to ask that how to overcome the problem of synchronising ? Itune showing me that the sync session is failed to start with my Ipad mini. Any ideas about what is going on ?

    What are you trying to sync?
    I see you are on ios 7.
    I also had upgraded my iPad Mini to ios 7 & then the 1st time I tried to open a Numbers file that was set up to sync w my MacBookPro, I got a warning that I would not be able to sync it any more w my Mac until I upgraded to Mavericks.
    So if you are trying to sync Numbers, Pages or Keynote files between your iPad mini in ios 7 and a Mac that hasn't been upgraded to Mavericks that could be the problem.
    I was very shocked to get that message since I bought Numbers on the iPad so that I could have a particular file on both devices & keep them synced. I had no clue when I upgraded to ios 7 on the iPad Mini that it would make it so the files in the iWorks apps woudln't sync any more.
    So I finally decided to go ahead & upgrade to Mavericks after carefully preparing & updating other software so that it would work w Mavericks. But I got error messages so haven't even been able to download Mavericks & now having 2nd thoughts about doing so.
    iPad mini ios 7
    MacBookPro Mid 2012 Mountain Lion
    iphone 4S ios 6

Maybe you are looking for

  • Export Reports into Excel?

    Can a summary of responses be exported into Excel?

  • HT4906 Trouble Syncing Photo Stream with iPad

    I am using 9.1.5 latest iPhoto yet I am unable to set Photo Stream in iMac system preferences. I am running 10.7.2? Any additional thoughts? The Photo Stream icon in iCloud preferences is grayed out. "iPhoto udate requiered" Puzzled

  • Database configuration

    hi am trying to configure my database in dbca am geting the error could not find appropriate listener for this database. configuration db control requires database to be registered with atleast one listener

  • Can someone pleeease help? I need to soften photos.

    I used to just be able to slide the "sharpen" tool to the left to soften images. I upgraded to iphoto '08 and they took that feature away from me. I need to be able to do that. Is there any freeware or inexpensive software that I can download to have

  • I can not sync my iPhone

    I can not sync my iPhone when I connect to my computer , I can see my pictures but on Itunes I have nothing ... I just changed Iphone recently. http://www.noelshack.com/2015-10-1425454422-iphone.jpg