• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

java.util.FormatFlagsConversionMismatchException: Conversion = s, Flags = 0

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Everyone,
here is my code .... please help me out of this...



String strQuery=sqlQuery;
Statement st=con.createStatement();
ResultSet rs=st.executeQuery(strQuery);
ResultSetMetaData metaData=rs.getMetaData();
int colCount =metaData.getColumnCount();
for(int i=1;i<=rowCount;i++){
System.out.print(metaData.getColumnName(i).format("%"+metaData.getColumnDisplaySize(i)+"s",metaData.getColumnName(i)).replace(" "," "));

}

and showing me the above error.


thanks,
karthik swamy
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I suggest you also print out your separate values* and post the results here. Perhaps some value isn't what you think it is.

* that means metaData.getColumnName(i), metaData.getColumnDisplaySize(i) and metaData.getColumnName(i)
 
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For mysql i have found the metadata to be a bit unreliable, The core things like column name, table name are all good, but sizes are a bit unreliable.

I don't know what database you are on, but you may find it is the same.
 
Who among you feels worthy enough to be my best friend? Test 1 is to read this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic