티스토리 뷰

program

ojdbc7 spring 적용

littlecarbb 2018. 7. 16. 12:09

How to add Oracle JDBC driver in your Maven local repository


Here’s a guide to show you how to add an Oracle JDBC driver into your Maven local repository, and also how to reference it in pom.xml.

Note
Due to Oracle license restrictions, the Oracle JDBC driver is not available in the public Maven repository. To use the Oracle JDBC driver with Maven, you have to download and install it manually into your Maven local repository.

1. Get Oracle JDBC Driver

Two ways to get the Oracle jdbc driver :

1.1. Visit Oracle website to get the Oracle JDBC driver – ojdbc6.jar or ojdbc7.jar


1.2. Not recommend, but you can get the JDBC driver from the Oracle database installed folder, for example – {ORACLE_HOME}\jdbc\lib\ojdbc6.jar



2. Maven Install

To install the Oracle jdbc drivers :

2.1 ojdbc6.jar

$ mvn install:install-file -Dfile={Path/to/your/ojdbc6.jar} 
      -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0 -Dpackaging=jar

2.2 ojdbc7.jar

$ mvn install:install-file -Dfile={Path/to/your/ojdbc7.jar} 
      -DgroupId=com.oracle -DartifactId=ojdbc7 -Dversion=12.1.0 -Dpackaging=jar

Full example to install a ojdbc7.jar

Terminal

> mvn install:install-file -Dfile=C:\\OracleJDBC\\ojdbc7.jar 
           -DgroupId=com.oracle -DartifactId=ojdbc7 -Dversion=12.1.0 -Dpackaging=jar

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.4:install-file (default-cli) @ standalone-pom ---
[INFO] Installing C:\OracleJDBC\ojdbc7.jar to C:\Users\mkyong\.m2\repository\com\oracle\ojdbc7\12.1.0\ojdbc7-12.1.0.jar
[INFO] Installing C:\Users\mkyong\AppData\Local\Temp\mvninstall2095378400735903278.pom 
       to C:\Users\mkyong\.m2\repository\com\oracle\ojdbc7\12.1.0\ojdbc7-12.1.0.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.332 s
[INFO] Finished at: 2017-02-13T21:26:03+08:00
[INFO] Final Memory: 8M/309M
[INFO] ------------------------------------------------------------------------

Done.

3. pom.xml

pom.xml

<dependencies>

        <!-- ojdbc6.jar example -->
        <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc6</artifactId>
            <version>11.2.0</version>
        </dependency>

        <!-- ojdbc7.jar example -->
        <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc7</artifactId>
            <version>12.1.0</version>
        </dependency>

</dependencies>

References

  1. How to include library manually into Maven local repository


출처 : https://www.mkyong.com/maven/how-to-add-oracle-jdbc-driver-in-your-maven-local-repository/


---------------------그이외------------------------------------

DataConfig.java basicDataSource.setDriverClassName("oracle.jdbc.driver.OracleDriver"); db.properties.xml dev.main.url=jdbc:oracle:thin:@220.XXX.XXX.XXX:1521:SID


mvn install:install-file -Dfile=C:\\WorkSpace\\BADoS\\src\\main\\webapp\\lib\\ojdbc7.jar -DgroupId=com.oracle -DartifactId=ojdbc7 -Dversion=12.1.0 -Dpackaging=jar


공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/11   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
글 보관함