Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Need help to connect Oracledb with Bitbucket Pipelines

Syed Rafi Mohammed June 11, 2021

Hi ,

I need help to connect OracleDB which is present on server by using Bitbucket pipeline. Can anyone help on this , how to connect Oracle DB with pipeline and prerequisites needed to be installed on Bitbucket Cloud.  

In Local machine, I followed JDBC Connection to connect oracle DB present on the server. It is executed successfully and retrieved.

Local Machine Script:

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

public class DbAll {
public static void main(String[] args) {
try{
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();

Connection cn=DriverManager.getConnection("jdbc:oracle:thin:@hostname:1521/DBName","username","password");
Statement smt=cn.createStatement();

//query to display 10 records from table employee
String q="select Col1,Col2,Col3 from oe_order_headers_all where rownum<11";

//to execute query
ResultSet rs=smt.executeQuery(q);

//to print the resultset on console
if(rs.next()){
do{
System.out.println(rs.getString(1)+","+rs.getString(2)+","+rs.getString(3));
}while(rs.next());
}
else{
System.out.println("Record Not Found...");
}
cn.close();
}
catch(Exception e){
System.out.println(e);
}
}
}

Note:

1. Same script can i use in bitbucket pipeline , can anyone suggest on this?.

2. Any .jar file or other script is there to connect from JDBC to OracleDb

3. It is possible to execute java files in bitbucket pipeline

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events