MySQL: Result characters are all spaces!!!?

The field names and contents in Table are all English. Can connect to DB, the result row number is right also, but when using getString("name"), the following exception occur:
SQLException: Column 'name' not found.
getString(1) can work, but the result string is comprised of spaces, exactly the same length!
Why?

my code segment:
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection("jdbc:mysql:///menagerie");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("select * from pet");
while(rs.next()) {
System.out.println("Name = " + rs.getString("name") + "<br>");
Thanks for reply!

Similar Messages

  • I open a donwloaded file from an e-mail and a file conversion box appears.The characters are all wierd.

    I can not open a downloaded file from an e-mail or off the web w/o a file conversion box popping up.It shows options to open with msoffice word but I choose that and it opens with all the characters that are weird looking. There is also the issue where every time I open up Mozzila there are portions of advertisements that look like they are in Japanese. I go to the View in the top bar then select Character Encoding.The unicode is selected so I switch to Western (ISO-8859-1) and everything is normal. I close the browser and restart and it goes back to the way it was with the Japanese looking text.

    You can convert the PDF text to regular text (.txt) and then import/open into another program and make your changes, then save the file in the programs format (for your later editing) and then choose Print from the program and there may/may not be a option to save as PDF again.
    You'll need a free (limited use) PDF to text utility like
    PDF OCR
    http://solutions.weblite.ca/pdfocrx/
    Trouble here of course is you lose all the formatting and have to reformat, but it's a lot less expensive than Adobe's software.
    LibreOffice is free to use and can save as PDF format if iWork doesn't save as PDF, it should unless Apple is really peeved at Adobe.

  • TS3276 I need feedback for the following issue. When I send email from this 27 inch iMac, the computer adds a string of characters in vertical column that represents the QWERTY key board, all alpha numeric characters are included. Yahoo mail, issue only o

    Restating my issue / question...
    When I send email from this iMac, there is a string of characters assigned. The characters are all the "alpha numeric" characters on the QWERTY key board. This only occurs when email is sent from this iMac. The issue does not manifest when using any other lap top or computer.
    Hence, I have ruled out the issue is a yahoo mail matter.
    Again, I can access the Yahoo mail account form multiple devices and send email without unintended assignment of character strings, but when I send wmail using this iMac, the issue happens everytime.
    Characters are stacked verticaly in a column. It looks as if all characters (except function keys) are included in the string.
    Any ideas?
    GMc

    Please read this whole message before doing anything.
    This procedure is a diagnostic test. It won’t solve your problem. Don’t be disappointed when you find that nothing has changed after you complete it.
    Third-party system modifications are a common cause of usability problems. By a “system modification,” I mean software that affects the operation of other software — potentially for the worse. The following procedure will help identify which such modifications you've installed. Don’t be alarmed by the complexity of these instructions — they’re easy to carry out and won’t change anything on your Mac. 
    These steps are to be taken while booted in “normal” mode, not in safe mode. If you’re now running in safe mode, reboot as usual before continuing. 
    Below are instructions to enter some UNIX shell commands. The commands are harmless, but they must be entered exactly as given in order to work. If you have doubts about the safety of the procedure suggested here, search this site for other discussions in which it’s been followed without any report of ill effects. 
    Some of the commands will line-wrap or scroll in your browser, but each one is really just a single line, all of which must be selected. You can accomplish this easily by triple-clicking anywhere in the line. The whole line will highlight, and you can then copy it. The headings “Step 1” and so on are not part of the commands. 
    Note: If you have more than one user account, Step 2 must be taken as an administrator. Ordinarily that would be the user created automatically when you booted the system for the first time. The other steps should be taken as the user who has the problem, if different. Most personal Macs have only one user, and in that case this paragraph doesn’t apply. 
    Launch the Terminal application in any of the following ways: 
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.) 
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens. 
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid. 
    When you launch Terminal, a text window will open with a line already in it, ending either in a dollar sign (“$”) or a percent sign (“%”). If you get the percent sign, enter “sh” and press return. You should then get a new line ending in a dollar sign. 
    Step 1 
    Triple-click the line of text below to select it:
    kextstat -kl | awk '!/com\.apple/{printf "%s %s\n", $6, $7}' | open -f -a TextEdit 
    Copy the selected text to the Clipboard by pressing the key combination command-C. Then click anywhere in the Terminal window and paste (command-V). A TextEdit window will open with the output of the command. Post the contents of that window, if any — the text, please, not a screenshot. You can then close the TextEdit window. The title of the window doesn't matter, and you don't need to post that. No typing is involved in this step.
    Step 2 
    Repeat with this line:
    { sudo launchctl list | sed 1d | awk '!/0x|com\.(apple|openssh|vix)|org\.(amav|apac|cups|isc|ntp|postf|x)/{print $3}'; sudo defaults read com.apple.loginwindow LoginHook; } | open -f -a TextEdit 
    This time you'll be prompted for your login password, which you do have to type. Nothing will be displayed when you type it. Type it carefully and then press return. You may get a one-time warning to be careful. Heed that warning, but don't post it. If you see a message that your username "is not in the sudoers file," then you're not logged in as an administrator. 
    Note: If you don’t have a login password, you’ll need to set one before taking this step. If that’s not possible, skip to the next step. 
    Step 3
    launchctl list | sed 1d | awk '!/0x|com\.apple|org\.(x|openbsd)/{print $3}' | open -f -a TextEdit 
    Step 4
    ls -1A /e*/mach* {,/}L*/{Ad,Compon,Ex,Fram,In,Keyb,La,Mail/Bu,P*P,Priv,Qu,Scripti,Servi,Spo,Sta}* L*/Fonts 2> /dev/null | open -f -a TextEdit  
    Important: If you formerly synchronized with a MobileMe account, your me.com email address may appear in the output of the above command. If so, anonymize it before posting. 
    Step 5
    osascript -e 'tell application "System Events" to get name of every login item' | open -f -a TextEdit 
    Remember, steps 1-5 are all copy-and-paste — no typing, except your password. Also remember to post the output. 
    You can then quit Terminal.

  • When I attempt to open iphoto, I get the loading icon in the working space/picture area.  If I try to reinstall ilife '11, will I lose any pictures?  Where, on the hard drive, are all my pictures actually stored?

    When I attempt to open iphoto, I get the loading icon in the working space/picture area.  If I try to reinstall ilife '11, will I lose any pictures?  Where, on the hard drive, are all my pictures actually stored?

    You won't lose anything because you have a back up, right?
    Most Simple Back Up
    Drag the iPhoto Library from your Pictures Folder to another Disk. This will make a copy on that disk.
    Slightly more complex:
    Use an app that will do incremental back ups. This is a very good way to work. The first time you run the back up the app will make a complete copy of the Library. Thereafter it will update the back up with the changes you have made. That makes subsequent back ups much faster. Many of these apps also have scheduling capabilities: So set it up and it will do the back up automatically. Examples of such apps: Chronosync or DejaVu . But are many others. Search on MacUpdate
    Option 1
    Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild. Choose to Rebuild iPhoto Library Database from automatic backup.
    If that fails:
    Option 2
    Download iPhoto Library Manager and use its rebuild function. This will create a new library based on data in the albumdata.xml file. Not everything will be brought over - no slideshows, books or calendars, for instance - but it should get all your albums and keywords back.
    Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one. .
    Regards
    TD

  • On my itunes library my albums are all sorted but when  i put onto my ipod touch (4th Gen) it seems to duplicate i have checked everything and there are no spaces in the information my question is how do isort it because these things drive me mad

    on my itunes library my albums are all sorted but when  i put onto my ipod touch (4th Gen) it seems to duplicate i have checked everything and there are no spaces in the information my question is how do isort it because these things drive me mad i would be most gratefully if you could find a way to help
    thatnks

    Never mind, got it to work. I stumbled around on Google for a while and somehow ended up reading things from the 'jailbroken' community. They had easy instructions to get out of Recovery mode. Thanks anyway though!
    P.S. For anyone who experiences this, here is the fix: Hold Power and Home in unison for 6 seconds, then power on as normal.

  • Bug in Keychain. All characters are replaced by strange symbols...

    Hello,
    For 2 weeks, I have a problem with the Mac OS Keychain.
    All characters are replaced by strange symbols...
    To see the bug : http://nsa20.casimages.com/img/2010/12/03/101203090829665703.png
    (my system is in french)
    Do you know how to solve this problem, please ?
    Thanks...

    Not a keychain bug, but a font issue. Restart and boot into safe mode as described in http://support.apple.com/kb/HT1564?viewlocale=en_US (you might need the French version), then do a normal boot. Once that's finished, launch Font Book, select all fonts, validate them and resolve duplicates, and restart. That should fix all your font issue.

  • Hi. I just got the iPhone 6, plugged into itunes and made the mistake of putting an OLD back up on my new phone resulting in losing all contacts after 2013. They are not saved on the cloud. Is there any way to go back to before I screwed up?

    Hi. I just got the iPhone 6, plugged into itunes and made the mistake of putting an OLD back up on my new phone resulting in losing all contacts after 2013. They are not saved on the cloud. Is there any way to go back to before I screwed up?

    If you have performed a sync with the device since you restored this old backup, then don't bother looking for another backup. iTunes writes over the last backup each time you sync. If you were handling contacts in iCloud, you would find them by logging into iCloud. Or you can check settings and iCloud and see if the button it on for Contacts. Otherwise it might have been on the computer, if you had a program that syncs with iTunes and handles contacts, depending on the computer system you use. If Windows, it would be Windows Contacts or Outlook. If a Mac, there is a Mac Address book as well.

  • Color space-creating a book in My publisher-.when I look at the share book pre print the colors are all dulled out. I work in pro photo rgb in LR and PS -.My Pub is sRGB-.where is the problem?

    Color space…creating a book in My publisher….when I look at the share book pre print the colors are all dulled out. I work in pro photo rgb in LR and PS ….My Pub is sRGB….where is the problem?

    I finally got to my references. This had to do with "soft proofing" on screen in Photoshop.
    So this may not help you at all. Re: Strange sRGB soft-proofing behavior  So go ahead and leave that setting at Basic.
    However there is a Color Management forum that you also go to and see if anyone has answers for your particular problem.
    Here is the link: Color management
    I hope they can help you out.
    Gene

  • Even though my apps are all closed, my battery is still draining 10% within the space of a minute, so what's up?

    Even though my apps are all closed, my battery is still draining 10% within the space of a minute?

    Does it do that also in Airplane mode?
    If yes, back to the Apple store (make an appointment first).

  • HT4906 Erase the disk for more space but ilife software are all missing!!!

    Hey, I just erase the disk for more space, when I reinstall mountain lion, the I life software are all missing! And in app store it shows up that I need to buy them! So ridiculous !!! Why I can use them before

    What's ridiculous? You erased the apps. They're not part of the OS. So, reinstall them for wherever their original source was.

  • I don't have very much space left on my iCloud backup. I had a previous iPhone, my current iPhone and my iPad that are all connected to one cloud. Can I delete the backup from my previous iPhone? Will it delete in the cloud AND on the phone?

    I had a previous iPhone, my current iPhone and my iPad that are all connected to one cloud. Can I delete the backup from my previous iPhone? Will it delete in the cloud AND on the phone? or does it just delete from iCloud? or does it just delete from the phone? Someone please help!

    You can delete the backup without any problem. Only the backup will be deleted from iCloud and nothing else will be deleted, so you can do it without worrying about losing data on iCloud or your devices

  • Help! Mail menus and icon text are all showing in Chinese/Asian characters!

    I am helping someone with their iMac G5 computer. A couple of days ago, all of a sudden the Mail program (v. 2.13) has all the menus, icon text, and mail folder descriptions (Inbox, Trash, Drafts, Sent, etc.) all showing in what looks to be Chinese (or other oriental language). I checked in System Prefs and language still set to US. None of the other program menus or text seem to be effected--just Mail. Anyone know what caused this or how to fix?? Thanks!

    Thanks for your reply. I am looking at the links you posted, but the problem here seems different. If you go into Mail, in the menu at the top, the word Mail is in English, then all of the other menu choices are written in what definitely appears to be an oriental language. If you click on a menu, all of the choices in the drop down menu are also oriental language. The e-mails themselves are in English, however the date of the e-mail is showing in oriental. On the left side, the words Inbox, Trash, etc. are all written in oriental as are the words under the icons. And, it's only in Mail. It just started doing this yesterday and the computer owner doesn't know why.
    Thanks so much for any further ideas/suggestions. I am going back to read more in the links you sent, but this seems a different problem.

  • Why are all the events in the XML SAX parser not activated?

    Hi everyone,
    I have written a mini server that parses XML files into SQL queries.
    Below is a segment of my code;
              try          {                                                       
                   Class.forName( JDBC_DRIVER );
                   myConnection = DriverManager.getConnection( DATABASE_URL, "username", "password");                                                  
                   EventXMLParser myEXP = new EventXMLParser(directory, myConnection);
                   File[] xmlFiles = directory.listFiles();
                   for (File xmlFile : xmlFiles)               {     
                        myEXP.XMLtoDB(xmlFile);
                        outWriter.println("File:" + xmlFile.getName() + " DONE");
              } catch (SQLException e)     {
                   System.err.println("SQLException for establishing connection");
                   e.printStackTrace();
              } catch (ClassNotFoundException e)     {
                   System.err.println("CLASS NOT FOUND EXCEPTION HERE");
                   e.printStackTrace();
              } catch (Exception e)     {
                   System.err.println(e);
                   e.printStackTrace();
              finally {
                   outWriter.println("PARSING COMPLETED");
                   outWriter.close();
         }Where the constructor EventXMLParser constructs the following:
         public EventXMLParser(File path, Connection connection)     {
              super();
              try     {
                   this.XMLpath = path;
                   this.db_connection = connection;
                   this.xr = XMLReaderFactory.createXMLReader();
                   this.XMLSAXhandler  = new DefaultHandler(); //create a new own handler
                   this.xr.setContentHandler(XMLSAXhandler);
                   this.xr.setErrorHandler(XMLSAXhandler);
                   //System.out.println("DEBUG: db_connection is " + db_connection.toString());
              catch (Exception e)     {
                   System.out.println("Constructor Error!");
                   e.printStackTrace();
         }Below are all my helper methods within EventXMLParser.java
         public void XMLtoDB(String XMLpath) throws Exception  {
              try     {
                   //Input
                   System.out.println("XMLpath is : " + XMLpath);
                   /*FileReader r = new FileReader(XMLpath); debug
                   InputSource in = new InputSource(r);
                   xr.parse(in);
                   xr.parse(XMLpath);
                   /* Note that while parsing, the end of each event, </event>
                    * will trigger sendSQL to execute the query on the database
              catch (Exception e)     {
                   throw new Exception("Error with XMLtoDB!! Exception: " + e);
         public void sendSQL(Event event, Connection sql_connection) throws SQLException     {
                   //JDBC part
                   try     {
                        System.err.println("DEBUG sendSQL");
                        Statement sql_statement = sql_connection.createStatement();
                        ResultSet resultSet = sql_statement.executeQuery( event.toSQL() );
                   catch (SQLException e)     {
                        e.printStackTrace();
         /* Parsing XML
          * From here onwards it's all designed for the SAX Parsing with different event calling methods
         public void startDocument()     {
              System.err.println("Start Document");
         public void endDocument()     {
              System.err.println("End Document");
         public void startElement(String uri, String name, String qName, Attributes atts)     {
              CurrentElement= name;
              System.out.println("This is parsing");
         public void characters(char ch[], int start, int length)     {
              SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
              StringBuffer sb = new StringBuffer();
              for (int i = start; i < start + length; i++)     
                   sb.append(ch);
              String content = sb.toString();
              if (CurrentElement.equals("eid"))
                   temp.setEventID( (Integer.valueOf(content)).intValue() ) ;
              else if (CurrentElement.equals("sd"))
                   temp.setShort_description(content);
              else if (CurrentElement.equals("ld"))
                   temp.setLong_description(content);
              else if ( (CurrentElement.equals("dt")))
                   temp.setDate_Time( formatter.parse(content, new ParsePosition(0)) );
              else if (CurrentElement.equals("repeat"))
                   temp.setRepeat_pattern( (Integer.valueOf(content)).intValue() );
              else if (CurrentElement.equals("valid"))
                   temp.setValid_period(content);
              else if (CurrentElement.equals("status"))     {
                   temp.setStatus( (Integer.valueOf(content)).intValue() );
              else {}
         public void endElement(String uri, String name, String qName)     {
              System.err.println("DEBUG" + temp.toString()); /*debug*/
              if (name.equals("event"))     {
                   try     {
                        /*debug*/ temp.setUserID(1);
                        /*debug*/ System.err.println("DEBUG: " + temp.toString());
                        sendSQL(temp, db_connection);
                        //temp = new Event();
                   catch (SQLException e)     {
                        System.err.println(e);
                   }//end catch
              }//end try
    Where event is a public class Event     {
         //fields
         private int userID = 1; // = 1 only applies for testing
         private int eventID;
         private String short_description;
         private String long_description;
         private Date date_time = null;
         private int repeat_pattern;
         private String valid_period;
         private int status;     //1 for new, 0 for modification and -1 for delete
         SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
         //Constructors
         //every event requires the following: userID eventID and short_Description
         public Event(int uID, int eID, String shortDescrp)     {
              setUserID(uID);
              setEventID(eID);
              setShort_description(shortDescrp);
         public Event(int uid, int eid, String sd,
                                  String ld, Date d_t, int r_p, String v_p, int s)     {
              setUserID(uid);
              setEventID(eid);
              setShort_description(sd);
              setLong_description(ld);
              setDate_Time(d_t);
              setRepeat_pattern(r_p);
              setValid_period(v_p);
              setStatus(s);
         //set
         public void setUserID (int x)                         { this.userID = x ;}
         public void setEventID (int x)                         { this.eventID = x ;}
         public void setShort_description (String x)          { this.short_description = x ;}
         public void setLong_description (String x)          { this.long_description = x ;}
         public void setDate_Time(Date x)                    { this.date_time = x ;}
         public void setRepeat_pattern (int x)               { this.repeat_pattern = x ;}
         public void setValid_period (String x)               { this.valid_period = x ;}
         public void setStatus (int x)                         { this.status = x; }
         //get
         public int           getUserID()                              { return this.userID;}
         public int           getEventID()                         { return this.eventID;}
         public String      getShort_description()               { return this.short_description;}
         public String      getLong_description()               { return this.long_description;}
         public Date        getDate_Time()                         { return this.date_time;}
         public int         getRepeat_pattern()                    { return this.repeat_pattern;}
         public String      getValid_period()                    { return this.valid_period;}
         public int           getStatus()                              { return this.status; }
         //Event to SQL statements;
         public String toSQL()     {
              StringBuffer sb = new StringBuffer();
              ///if ( status == 1)     {
                   sb.append( "INSERT INTO events SET" );
                   sb.append( " userID = " + userID + ", ");
                   sb.append( "eventID = " + eventID + ", " );
                   sb.append( "short_description = " + "\'" + short_description + "\'" + ", "); //String
                   sb.append( "long_description = " + "\'" + long_description + "\'"  + ", "); //String
                   sb.append( "date_time = " + "\'" + formatter.format(date_time) + "\'" + ", ");
                   sb.append( "repeat_pattern = " + repeat_pattern + ", " );
                   sb.append( "valid_period = " + "\'" + valid_period + "\'" ); //String
                   sb.append( ";");
              //} else if ( status == 2)      {
              System.err.println(sb.toString());
              return sb.toString();
    }     My question is: I have taken my SQL query generated by toSQL() method in events and it worked.
    Here is the funny thing:
    Everything is correct syntax wise: No complaints what soever
    The mysql part works: Tested separately.
    So I tend to think that the problem lies within the SAX parser. I have written SAX2 parsers on this machine before and they have worked too. I tried inserting println statements all over startElement endElement etc etc only to find out that the SAX parser did not call any of the methods that I overided!! Why is that so?
    Can you guys spot where my SAX parser fails?

    I see.
    I try to correct this problem by removing super();
    so right now my code looks like this:
         static Event temp = new Event(0, 0, "null", "null", new Date(), 0, "null", 0);
         static String CurrentElement = null;
         static File XMLpath;
         static Connection db_connection;
         static XMLReader xr;
         static DefaultHandler XMLSAXhandler; 
         //Constructor,      Build the SAX Parser
         public EventXMLParser(File path, Connection connection)     {
              try     {
                   this.XMLpath = path;
                   this.db_connection = connection;
                   this.xr = XMLReaderFactory.createXMLReader();
                   this.XMLSAXhandler  = new DefaultHandler(); //create a new own handler
                   this.xr.setContentHandler(XMLSAXhandler);
                   this.xr.setErrorHandler(XMLSAXhandler);
                   //System.out.println("DEBUG: db_connection is " + db_connection.toString());
              catch (Exception e)     {
                   System.out.println("Constructor Error!");
                   e.printStackTrace();
         }This time, I created a new instance of default handler() which can be referenced by as the objects's XMLSAXhandler. However, that did not solve the problem, why does the problem still persist?
    Right now, there is only one instance of a default handler created. So why does all my parsing event functions still get ignored?

  • Why are all my paths disappearing when I save some files as jpegs?

    I have 2 identical PSD files. Both have 10 different paths that are identical for each file. When I flatten and save one file as a jpeg the paths stay in the file just fine as is usually the case. When I open the jpeg the paths are still there as they should be.
    When I save the other file as a jpeg all the paths are there after I've saved the file and BEFORE I've closed the file. After closing and reopening the file the paths are all gone. If I save the same file as a tiff the paths all stay as usual.
    I've never seen this happen in almost 20 years of using Photoshop.
    Anybody have any ideas?
    Thank you

    I am NOT using "save jpeg for web" just to be clear.
    If I were, then the other image wouldn't be keeping any of its paths either.
    I am using "Jpeg" in the Save As dialogue box.
    If I edit the jpeg that lost its paths after opening it and hit "Save" it gives me the compression options dialogue box. Other jpegs just "save" when I hit save, I've never had a jpeg give me that dialogue box before when hitting just "Save".
    If, after opening the image that lost its paths, I paste a path into that image and hit "Save"(using one of the same original paths from the same original psd file), it gives me the compression dialogue box. If I complete the "Save" and reopen the image, voila, the path I pasted into it is still there, and, if I edit the image and hit "Save" it becomes normal again and saves without showing the compression options dialogue box.
    Photoshop CS6 version 13.0.5
    iMAC 27"
    12 gigs of RAM 5 gigs free
    800 gigs of free space on the system drive
    Snow Leopard 10.6.8
    Disk Permissions Repaired
    There really is no reason for this to happen. There are no differences in the images except for the content of the image and the file names.
    I have tried new file names and still the same result.
    I have tried working from the Desktop and still the same result.
    This is a serious bug.

  • Arabic characters are no longer displaying properly in NB 6.7

    Hello all -
    Up until NB 6.5.1, my GUI displayed Arabic characters properly as typed. As I shifted to NB 6.7 Beta today, all those Arabic characters are shown as funny binary-looking characters! But, this only occurs when I am running from within the NB space. When I run the application by clicking the jar files, the characters print OK.
    Questions:
    - Is this happening because it is a beta version may be?
    - Is there a way or a place where I have to set some properties to display the Unicode characters correctly?
    For example, I thought all I had to do was right-click the project --> Properties --> Source --> Encoding: UTF-8
    Thank you for any help.
    PS: I am posting this problem in the Internationalization forums.

    PS: I am posting this problem in the Internationalization forums.A more appropriate place might be a NetBeans forum.
    db

Maybe you are looking for