SQL Data Types | JDBC Type Codes | Standard Java Types | Oracle Extension Java Types |
| STANDARD JDBC TYPES: | | |
CHAR | java.sql.Types.CHAR | java.lang.String | oracle.sql.CHAR |
VARCHAR2 | java.sql.Types.VARCHAR | java.lang.String | oracle.sql.CHAR |
LONG | java.sql.Types.LONGVARCHAR | java.lang.String | oracle.sql.CHAR |
NUMBER | java.sql.Types.NUMERIC | java.math.BigDecimal | oracle.sql.NUMBER |
NUMBER | java.sql.Types.DECIMAL | java.math.BigDecimal | oracle.sql.NUMBER |
NUMBER | java.sql.Types.BIT | boolean | oracle.sql.NUMBER |
NUMBER | java.sql.Types.TINYINT | byte | oracle.sql.NUMBER |
NUMBER | java.sql.Types.SMALLINT | short | oracle.sql.NUMBER |
NUMBER | java.sql.Types.INTEGER | int | oracle.sql.NUMBER |
NUMBER | java.sql.Types.BIGINT | long | oracle.sql.NUMBER |
NUMBER | java.sql.Types.REAL | float | oracle.sql.NUMBER |
NUMBER | java.sql.Types.FLOAT | double | oracle.sql.NUMBER |
NUMBER | java.sql.Types.DOUBLE | double | oracle.sql.NUMBER |
RAW | java.sql.Types.BINARY | byte[] | oracle.sql.RAW |
RAW | java.sql.Types.VARBINARY | byte[] | oracle.sql.RAW |
LONGRAW | java.sql.Types.LONGVARBINARY | byte[] | oracle.sql.RAW |
DATE | java.sql.Types.DATE | java.sql.Date | oracle.sql.DATE |
DATE | java.sql.Types.TIME | java.sql.Time | oracle.sql.DATE |
TIMESTAMP | java.sql.Types.TIMESTAMP | javal.sql.Timestamp | oracle.sql.TIMESTAMP |
BLOB | java.sql.Types.BLOB | java.sql.Blob | oracle.sql.BLOB |
CLOB | java.sql.Types.CLOB | java.sql.Clob | oracle.sql.CLOB |
user-defined object | java.sql.Types.STRUCT | java.sql.Struct | oracle.sql.STRUCT |
user-defined reference | java.sql.Types.REF | java.sql.Ref | oracle.sql.REF |
user-defined collection | java.sql.Types.ARRAY | java.sql.Array | oracle.sql.ARRAY |
ROWID | java.sql.Types.ROWID | java.sql.RowId | oracle.sql.ROWID |
NCLOB | java.sql.Types.NCLOB | java.sql.NClob | oracle.sql.NCLOB |
NCHAR | java.sql.Types.NCHAR | java.lang.String | oracle.sql.CHAR |
| ORACLE EXTENSIONS: | | |
BFILE | oracle.jdbc.OracleTypes.BFILE | NA | oracle.sql.BFILE |
REF CURSOR | oracle.jdbc.OracleTypes.CURSOR | java.sql.ResultSet | oracle.jdbc.OracleResultSet |
TIMESTAMP | oracle.jdbc.OracleTypes.TIMESTAMP | java.sql.Timestamp | oracle.sql.TIMESTAMP |
TIMESTAMP WITH TIME ZONE | oracle.jdbc.OracleTypes.TIMESTAMPTZ | java.sql.Timestamp | oracle.sql.TIMESTAMPTZ |
TIMESTAMP WITH LOCAL TIME ZONE | oracle.jdbc.OracleTypes.TIMESTAMPLTZ | java.sql.Timestamp | oracle.sql.TIMESTAMPLTZ |
Wednesday, November 30, 2011
Default Mappings Between Oracle SQL Types and Java Types
Default JDeveloper Entity Object Attribute Type Mappings
Oracle Column Type | Entity Column Type | Entity Java Type |
NVARCHAR2(n), VARCHAR2(n), NCHAR VARYING(n), VARCHAR(n) | VARCHAR2 | java.lang.String |
NUMBER | NUMBER | oracle.jbo.domain.Number |
DATE | DATE | oracle.jbo.domain.Date |
TIMESTAMP(n), TIMESTAMP(n) WITH TIME ZONE, TIMESTAMP(n) WITH LOCAL TIME ZONE | TIMESTAMP | java.sql.Timestamp |
LONG | LONG | java.lang.String |
RAW(n) | RAW | oracle.jbo.domain.Raw |
LONG RAW | LONG RAW | oracle.jbo.domain.Raw |
ROWID | ROWID | oracle.jbo.domain.RowID |
NCHAR, CHAR | CHAR | oracle.jbo.domain.Char |
CLOB | CLOB | oracle.jbo.domain.ClobDomain |
NCLOB | NCLOB | oracle.jbo.domain.NClobDomain |
BLOB | BLOB | oracle.jbo.domain.BlobDomain |
BFILE | BFILE | oracle.jbo.domain.BFileDomain |
ORDSYS.ORDIMAGE | ORDSYS.ORDIMAGE | oracle.ord.im.OrdImageDomain |
ORDSYS.ORDVIDEO | ORDSYS.ORDVIDEO | oracle.ord.im.OrdVideoDomain |
ORDSYS.ORDAUDIO | ORDSYS.ORDAUDIO | oracle.ord.im.OrdAudioDomain |
ORDSYS.ORDDOC | ORDSYS.ORDDOC | oracle.ord.im.OrdDocDomain |
Note: | ||
In addition to the types mentioned here, you can use any Java object type as an entity object attribute's type, provided it implements the java.io.Serializable interface. |
Tuesday, November 29, 2011
Data Types - Oracle Number - Java Integer - Java Long
Java Class Integer
The
Max Value The maximum value an
Min Value The minimum value an
The
int
data type is a 32-bit signed two's complement integer.Max Value The maximum value an
int
can have: 231-1 (2,147,483,647)Min Value The minimum value an
int
can have: -231 (-2,147,483,648)Java Class Long
The
long
data type is a 64-bit signed two's complement integer. Max Value The maximum value an
int
can have: 9,223,372,036,854,775,807Min Value The minimum value an
int
can have: -9,223,372,036,854,775,808 Oracle Number Datatype
The
column_name NUMBER (precision, scale)
AND
NUMBER without Precision & Scale is 38 significant digits.
Below is a table from Oracle® Database Concepts Native Data Types
NUMBER
datatype stores fixed and floating-point numbers.- Positive numbers in the range 1 x 10-130 to 9.99...9 x 10125 with up to 38 significant digits
- Negative numbers in the range -1 x 10-130 to 9.99...99 x 10125 with up to 38 significant digits
- Zero
column_name NUMBER (precision, scale)
AND
NUMBER without Precision & Scale is 38 significant digits.
It is good practice to specify the scale and precision of a fixed-point number column for extra integrity checking on input. Specifying scale and precision does not force all values to a fixed length. If a value exceeds the precision, then Oracle returns an error. If a value exceeds the scale, then Oracle rounds it.
Specify an integer using the following form:
NUMBER(p)
This represents a fixed-point number with precision
p
and scale 0 and is equivalent to NUMBER(p,0)
.Specify a floating-point number using the following form:
NUMBER
The absence of precision and scale designators specifies the maximum range and precision for an Oracle number.
Below is a table from Oracle® Database Concepts Native Data Types
Input Data | Specified As | Stored As |
---|---|---|
7,456,123.89 | NUMBER | 7456123.89 |
7,456,123.89 | NUMBER(*,1) | 7456123.9 |
7,456,123.89 | NUMBER(9) | 7456124 |
7,456,123.89 | NUMBER(9,2) | 7456123.89 |
7,456,123.89 | NUMBER(9,1) | 7456123.9 |
7,456,123.89 | NUMBER(6) | (not accepted, exceeds precision) |
7,456,123.89 | NUMBER(7,-2) | 7456100 |
Monday, November 14, 2011
Unable to lookup Data Source at context java:comp/env/jdbc/DBName_DS
oracle.jbo.DMLException: JBO-27200: JNDI failure. Unable to lookup Data Source at context jdbc/PTS2DS
at oracle.jbo.server.DBTransactionImpl.lookupDataSource(DBTransactionImpl.java:1453)
at oracle.jbo.server.DBTransactionImpl2.connectToDataSource(DBTransactionImpl2.java:329)
-----------------------------------------------------------------------------------------
Form Shay Shmeltzer's Common pitfalls when deploying from JDeveloper 11g to WebLogic 10.3
Data-sources - and not finding them
When you are building an ADF BC application, or any other Java EE application for that matter, you should take advantage of the data-sources capabilities of your server.
In ADF BC's application module configuration it is quite easy to edit the configuration and replace the connection to be based on a JDBC DataSource instead of direct JDBC connection - once you do that the JDBC data source name will be something like: java:comp/env/jdbc/scottDS (where scott is the name of the DB connection you defined for your application).
After you did this modification, the next step is to go into the WLS admin console and define a data source. The important thing here is to have the JNDI Name be: jdbc/scottDS
This way your JDBC connection will be found.
One more common overlooked thing here is that after you define the data source in WLS you need to give it a target. So click the Targets tab and assign the datasource to the server you are going to deploy to.
---------------------------------------------------------------------------------------
Problem was i needed to rebuild the projects in JDev. -- I was running the page off the application Navigator page so I needed to go to Build...
- Build -> CleanAll
// then //
Build->MakeAll
This removed the problem....
Wednesday, November 2, 2011
Thread: JDeveloper 11g/ADF JPA/EJB form; Commit operation missing in Data Control?
|
|
|
|
Implementing DBSequences in an ADF Application
Below is a nice tutorial on how to programmatically use dbsequences as well as how to use trigger based dbsequence as an attribute in an entity.
http://www.youtube.com/watch?v=QIkwwdzYmJE
(new oracle.jbo.server.SequenceImpl("STOCKUSER.RUNID_SEQ", adf.object.getDBTransaction())).
getSequenceNumber()
http://www.youtube.com/watch?v=QIkwwdzYmJE
Summary for no trigger based dbsequence
If you have a sequence Number (here: "STOCKUSER.RUNID_SEQ") -- and no trigger to populate the dbSequence -- you can populate the DBSequence attribute in the Entity Object Default Value / Expression as such:(new oracle.jbo.server.SequenceImpl("STOCKUSER.RUNID_SEQ", adf.object.getDBTransaction())).
getSequenceNumber()
Subscribe to:
Posts (Atom)