Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mapping java.long to oracle.Number(14)

I have db column whose datatype is Number (15) and i have the corresponding field in java classes as long. The question is how would i map it using java.sql.Types.

  • would Types.BIGINT work?
  • Or shall i use something else?

P.S: I can't afford to change the datatype within java class and within DB.

like image 951
x.509 Avatar asked Oct 03 '11 17:10

x.509


People also ask

What is the size of long data type in Oracle?

The LONG datatype stores variable-length character strings containing up to two gigabytes, but with many restrictions. This datatype is provided for backward compatibility with existing applications; in general, new applications should use CLOB and NCLOB datatypes to store large amounts of character data.

What is the length of integer in Oracle?

INTEGER has a lower bound of -2,147,483,648 and an upper bound of 2,147,483,647.

What is the Java type mapping for the sql type CLOB?

Blob is the mapping for the SQL BLOB (binary large object) type; java. sql. Clob is the mapping for the SQL CLOB (character large object) type. BLOB and CLOB objects are collectively referred to as LOBs (large objects).


1 Answers

From this link it says that java.sql.Types.BIGINT should be used for long in Java to Number in SQL (Oracle).

Attaching screenshot of the table in case the link ever dies.

SQL and JDBC datatypes

like image 161
Mike Avatar answered Sep 20 '22 05:09

Mike