2017  Kodetalk | Feedback | Privacy Policy | Terms | About
userimage

configure jdbc in maven

<dependency>     
<groupId>com.oracle</groupId>     
<artifactId>ojdbc14</artifactId>     
<version>11.2.0.3</version> 
</dependency>
this code not working in eclipse
can you tell me correct configure to connect ojdbc14
userimage

sometimes it happens like the jar you expecting from maven repository will not be available direcly:


in that case we need to specify the location of the repository for example if i want to add neo4j libs in my classpath i need to add the repository location as below:


<repositories>
        <repository>
            <id>neo4j-public</id>
            <url>http://m2.neo4j.org/content/groups/public</url>
            <releases>
                <enabled>true</enabled>
                <checksumPolicy>warn</checksumPolicy>
            </releases>
        </repository>
    </repositories>


and the configuration you have mentioned to get ojdbc driver i did not get the version from maven directly.


My configuration for getting ojdbc14 as below:


<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>yourproject</groupId>
    <artifactId>yourprojectartifact</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>war</packaging>
    <properties>
        <java-version>1.8</java-version>
        <ojdbc>14</ojdbc>
    </properties>
    <dependencies>
        <dependency>
            <groupId>ojdbc</groupId>
            <artifactId>ojdbc</artifactId>
            <version>${ojdbc}</version>
        </dependency>
    </dependencies>
    <build>
        <sourceDirectory>src</sourceDirectory>
        <resources>
            <resource>
                <directory>src</directory>
                <excludes>
                    <exclude>**/*.java</exclude>
                </excludes>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.6</version>
                <configuration>
                    <warSourceDirectory>WebContent</warSourceDirectory>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>


The configuration you mentioned, i feel its wrong else if you want the version you mentioned please check from which repository you will get. Else please follow my mentioned configuration, you will get the jar in your classpath.

Answer is