Skip to content

About DatabaseMetaData#getColumns's DATA_TYPE... #859

@onacit

Description

@onacit

Describe the bug
According to the description of DatabaseMetaData#getColumns, the type of DATA_TYPE column supposed to be int.

DATA_TYPE int => SQL type from java.sql.Types

To Reproduce

        try (var connection = connect()) {
            final var cmd = connection.getMetaData();
            try (var results = cmd.getColumns(null, null, "%", "%")) {
                final var rsmd = results.getMetaData();
                for (int i = 1; i <= rsmd.getColumnCount(); i++) {
                    final var label = rsmd.getColumnLabel(i);
                    if (!"DATA_TYPE".equals(label)) {
                        continue;
                    }
                    final var type = rsmd.getColumnType(i);
                    log.debug("type: {}, {}", type, JDBCType.valueOf(type));
                }
            }
        }
type: 12, VARCHAR

Expected behavior
Should be, or may be, type: 4, INTEGER.

Logs
N/A

Environment (please complete the following information):

Apache Maven 3.9.0 (9b58d2bad23a66be161c4664ef21ce219c2c8584)
Maven home: /Users/onacit/.m2/wrapper/dists/apache-maven-3.9.0-bin/7u41pcsb933vr4m6u83d7ofakm/apache-maven-3.9.0
Java version: 17.0.6, vendor: Eclipse Adoptium, runtime: /Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home
Default locale: en_KR, platform encoding: UTF-8
OS name: "mac os x", version: "13.2.1", arch: "aarch64", family: "mac"
    <dependency>
      <groupId>org.xerial</groupId>
      <artifactId>sqlite-jdbc</artifactId>
      <version>3.41.0.0</version>
      <scope>test</scope>
    </dependency>

Additional context
N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancement:JDBCEnhancement specific to the JDBC standardreleasedIssue has been released

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions