Description of getDatabaseMetadata()["COLUMN_SIZE"] in Javadoc:
"The COLUMN_SIZE column specifies the column size for the given column.
For character data, this is the ***length in characters***."
Scenario:
- Check that database encoding is multiple bytes per character.
- Create column with the definition VARCHAR2(4 BYTE).
- Try to insert 4 characters each of which is encoded as multiple bytes.
- DBMS correctly generates ORA-12899: value too large for column (actual: 8, maximum: 4)
- Issue: Oracle JDBC driver getDatabaseMetadata()["COLUMN_SIZE"] returns 4, should return 1.
Steps to reproduce:
select * from NLS_DATABASE_PARAMETERS where PARAMETER = 'NLS_CHARACTERSET';
-- NLS_LENGTH_SEMANTICS = BYTE
-- NLS_CHARACTERSET = AL32UTF8
create table T {
C VARCHAR2(4 BYTE)
);
insert into T(C) values ('1234');
-- OK
insert into T(C) values ('яяяя');
-- SQL Error: ORA-12899: value too large for column "T"."C" (actual: 8, maximum: 4)
Write Java program where you get getDatabaseMetadata()["COLUMN_SIZE"].
-- It returns 4, should return 1.