The moose likes JDBC and the fly likes java.util.FormatFlagsConversionMismatchException: Conversion = s, Flags = 0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "java.util.FormatFlagsConversionMismatchException: Conversion = s, Flags = 0" Watch "java.util.FormatFlagsConversionMismatchException: Conversion = s, Flags = 0" New topic

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

karthik swamy
Ranch Hand

Joined: Mar 14, 2011
Posts: 39
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.

karthik swamy
Rob Spoor

Joined: Oct 27, 2005
Posts: 19651

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)

How To Ask Questions How To Answer Questions
Wendy Gibbons

Joined: Oct 21, 2008
Posts: 1107

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.
I agree. Here's the link: http://aspose.com/file-tools
subject: java.util.FormatFlagsConversionMismatchException: Conversion = s, Flags = 0
Similar Threads
How to find the column names..???
how to save values at a perticular index of the List?
Cannot create a new table
java.sql.SQLException: Non supported SQL92 token at position: 377:
Appending records to a text area