Why Metadata is different in different databases?

I tried to use ResultSetMetaData.getColumnDataTypeName to get Datatype of an Attribute, but am getting Number for INTEGER,FLOAT and DOUBLE datatypes in Oracle, and DATETIME for DATE , TIMESTAMP and TIME in Access , i am writing one generic method to update table using file. can anyone please tell me how to get a datatype name given while creating table.

Re: Why Metadata is different in different databases?

Re: Why Metadata is different in different databases?

Originally Posted by Arun_N

I tried to use ResultSetMetaData.getColumnDataTypeName to get Datatype of an Attribute, but am getting Number for INTEGER,FLOAT and DOUBLE datatypes in Oracle, and DATETIME for DATE , TIMESTAMP and TIME in Access , i am writing one generic method to update table using file. can anyone please tell me how to get a datatype name given while creating table.

I think Access is wrong; the Oracle data types INTEGER, FLOAT and DOUBLE can be mapped to the Java Number type but a type DATETIME doesn't even exist in Java; it should be a Timestamp type i.m.h.o.

Re: Why Metadata is different in different databases?

I just want to get the datatype through java code , which i used to create table, is it possible? for example if i used Integer as a datatype while creating attribute , i want same value as INTEGER is it possible in oracle? since am writing genric class to insert,Update or delete from any table , while using prepared statement i might need the exact datatype if it is Integer or float or double.

Re: Why Metadata is different in different databases?

Originally Posted by Arun_N

I just want to get the datatype through java code , which i used to create table, is it possible? for example if i used Integer as a datatype while creating attribute , i want same value as INTEGER is it possible in oracle? since am writing genric class to insert,Update or delete from any table , while using prepared statement i might need the exact datatype if it is Integer or float or double.

I don't know what the Oracle database does, e.g. are you able to insert floating point value, say, 123.456 in a column that was declared of type Integer? (of course only 123 would be stored). If so, Oracle can only return the type/class Number for that column. It's a can of slimey worms if both Java and your database can perform implicit casts ...

Re: Why Metadata is different in different databases?

For the number types look at the scale and precision values to determine the actual type you want. For "DATETIME" there should also be something equivalent (possibly even the same fields with other values, but I doubt that).

Re: Why Metadata is different in different databases?

Like I said, use the ResultMetaData and inspect the scale and precision of the field definition, that will at least tell you whether it wants a whole number (int, long) or floating point (float, double) and whether the "length" is larger than an int/float will allow telling you that it is a long/double.