In the java.sql.types
class, there are types which are easily mapped to MySQL types. For example, VARCHAR
in the java.sql.types
class is mapped to VARCHAR
in MySQL.
However, I am unsure how types in the java.sql.types class such as JAVA_OBJECT
can be mapped to types in MySQL when similar types don't exist in MySQL. In such cases, what would the JDBC do?
If JDBC driver does not support a type you try to use - it will try to map it to the nearest possible datatype which is supported. And if it can not do that - SQLException
is thrown.
JDBC is just an interface for working with databases. And it's possible that some parts of the API may be not supported by a database. What happens in this case totally depends on driver's implementation. That's common for all JDBC drivers.
Concerning MySQL, you can get the list of supported datatypes and their mappings from the official documentation.