RE: JDBC 3.00.JC3 DatabaseMetaData getColumns DATETIME bug
Posted in 2007
Topics: Performance & Tuning, Connectivity: ODBC / JDBC / .NET, Data Types & Schema Design, Java & JDBC Development
Doug, I am not completely sure it's wrong... Thus it looks wrong, but in the first example you get the metadata of the resultset and in the second case you get the metadata of the database. In absolute, it should be the same. In real life, with optimization and things done in the query optimizer it sounds possible that the data type is altered... Have you tried to force the query output with some sort of cast? Have you tried with older version of the JDBC driver? My 2cts... > -----Original Message----- > From: informix-list-bounces@iiug.org [mailto:informix-list- > bounces@iiug.org] On Behalf Of Doug Lawry > Sent: Tuesday, January 02, 2007 15:31 > To: informix-list@iiug.org > Subject: JDBC 3.00.JC3 DatabaseMetaData getColumns DATETIME bug > > If a table contains a DATETIME HOUR TO MINUTE/SECOND/FRACTION column, the > latest > version of the IBM Informix JDBC driver returns inconsistent meta data > depending > on the method used: > > Code: > > st = con.createStatement(); > ResultSet rs = st.executeQuery("SELECT * FROM test_table"); > ResultSetMetaData md = rs.getMetaData(); > System.out.println(md.getColumnType(1)); > > Output: > > 92 (java.sql.Time) > > Code: > > DatabaseMetaData md = con.getMetaData(); > ResultSet rs = md.getColumns("", "", "test_table", ""); > rs.next(); > System.out.println(rs.getString("DATA_TYPE")); > > Output: > > 93 (java.sql.Timestamp) > > In our opinion, Time is the correct corresponding Java data type, and the > second > case is a bug. Would someone be able to submit a request to get this > fixed? > > -- > Regards, > Doug Lawry > www.douglawry.webhop.org > > > _______________________________________________ > Informix-list mailing list > Informix-list@iiug.org > http://www.iiug.org/mailman/listinfo/informix-list
You misunderstand, J-G: the query gets it right :-) We can't cast the data because it's a generic tool. Just gone back as far as 2.21.JC3: same problem. "Jean Georges Perrin" <jgp@jgp.net> wrote in message news:mailman.747.1167835976.29126.informix-list@iiug.org... > Doug, > > I am not completely sure it's wrong... Thus it looks wrong, but in the first > example you get the metadata of the resultset and in the second case you get > the metadata of the database. > > In absolute, it should be the same. In real life, with optimization and > things done in the query optimizer it sounds possible that the data type is > altered... > > Have you tried to force the query output with some sort of cast? > > Have you tried with older version of the JDBC driver? > > My 2cts... > >> -----Original Message----- >> From: informix-list-bounces@iiug.org [mailto:informix-list- >> bounces@iiug.org] On Behalf Of Doug Lawry >> Sent: Tuesday, January 02, 2007 15:31 >> To: informix-list@iiug.org >> Subject: JDBC 3.00.JC3 DatabaseMetaData getColumns DATETIME bug >> >> If a table contains a DATETIME HOUR TO MINUTE/SECOND/FRACTION column, the >> latest >> version of the IBM Informix JDBC driver returns inconsistent meta data >> depending >> on the method used: >> >> Code: >> >> st = con.createStatement(); >> ResultSet rs = st.executeQuery("SELECT * FROM test_table"); >> ResultSetMetaData md = rs.getMetaData(); >> System.out.println(md.getColumnType(1)); >> >> Output: >> >> 92 (java.sql.Time) >> >> Code: >> >> DatabaseMetaData md = con.getMetaData(); >> ResultSet rs = md.getColumns("", "", "test_table", ""); >> rs.next(); >> System.out.println(rs.getString("DATA_TYPE")); >> >> Output: >> >> 93 (java.sql.Timestamp) >> >> In our opinion, Time is the correct corresponding Java data type, and the >> second >> case is a bug. Would someone be able to submit a request to get this >> fixed? >> >> -- >> Regards, >> Doug Lawry >> www.douglawry.webhop.org