Search code examples
javaoraclespring-bootoracle8i

How to connect to Oracle 8i using Java


How do you connect to an Oracle 8i db from a Java/SpringBoot Application?

Which ojdbc jar file should I use? I have tried using:

<!-- https://mvnrepository.com/artifact/com.oracle.database.jdbc/ojdbc8 -->
<dependency>
    <groupId>com.oracle.database.jdbc</groupId>
    <artifactId>ojdbc8</artifactId>
    <version>12.2.0.1</version>
</dependency>

but it did not connect and I got the below error:

Failed to initialize pool: Index 7 out of bounds for length 2
com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: Index 7 out of bounds for length 2

Apart from this can we do batch insert in Oracle 8i? If yes then how to do?


Solution

  • As per this, the recommended JDBC driver is ojdbc14.jar for Java 1.4 or newer, so download and include it in your project manually or through your pom.xml if you have access to a compatible repository.

    It may not be available directly in Maven Central, so you may need to install it in your local Maven Repository manually:

    mvn install:install-file -Dfile=path/to/ojdbc14.jar -DgroupId=com.oracle -DartifactId=ojdbc14 -Dversion=1.0 -Dpackaging=jar
    

    And in your pom.xml:

    <dependency>
        <groupId>com.oracle</groupId>
        <artifactId>ojdbc14</artifactId>
        <version>1.0</version>
    </dependency>