Hi all,
I'm working in a Bitbucket plugin using Atlassian SDK. My target is Bitbucket version is 4.2.0
I'm trying to connect the plugin to a external Oracle database, but I'm getting a "oracle.jdbc.OracleDriver not found" exception at runtime (in standalone instance or in my Bitbucket server instance).
I'm trying to get the connection using:
Class.forName("oracle.jdbc.OracleDriver"); Connection conn = DriverManager.getConnection(CONNECTION_STRING);
When I use my database connection class into another program (not into a plugin) it works fine.
I looked in some pages (into answers.atlassian.com) another ways to import via pom.xml using <import-Pachage> or <dependency> but don't work for me.
Thanks for help
Community moderators have prevented the ability to post new answers.
I solved my ploblem using JNI.
My pom.xml
<build> <plugins> <plugin> <groupId>com.atlassian.maven.plugins</groupId> <artifactId>bitbucket-maven-plugin</artifactId> <version>${amps.version}</version> <extensions>true</extensions> <configuration> <products> <product> <id>bitbucket</id> <instanceId>bitbucket</instanceId> <version>${bitbucket.version}</version> <dataVersion>${bitbucket.data.version}</dataVersion> <dataSources> <dataSource> <jndi>jdbc/OracleDataSource</jndi> <url>jdbc:oracle:thin:@99.99.99.99:XE</url> <username>USER</username> <password>PASSWD</password> <driver>oracle.jdbc.OracleDriver</driver> <libArtifacts> <libArtifact> <groupId>com.oracle</groupId> <artifactId>ojdbc6</artifactId> <version>11.2.0</version> </libArtifact> </libArtifacts> </dataSource> </dataSources> ... </product> </configuration> </plugin> ... <build>
Bitbucket context.xml
<Context> <Resource name="jdbc/OracleDataSource" type="javax.sql.DataSource" description="Oracle datasource for plugins" username="USER" password="PASWD" driverClassName="oracle.jdbc.OracleDriver" url="jdbc:oracle:thin:@99.99.99.99:1521:XE"/> </Context>
Bitbucket server.xml
<GlobalNamingResources> <Resource name="jdbc/OracleDataSource" type="javax.sql.DataSource" description="Oracle datasource for plugins" username="SYSTEM" password="123abc" driverClassName="oracle.jdbc.OracleDriver" url="jdbc:oracle:thin:@192.168.0.49:1521:XE"/> </GlobalNamingResources>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.