
obride (CVE-2018-25075)
OBridge는 Oracle PL/SQL 패키지 프로시저를 호출하기 위한 간단한 Java 소스 코드 생성기를 제공합니다.
지원되는 입력, 출력 매개변수 및 반환 값은 다음과 같습니다:
다음 유형은 JDBC 드라이버가 지원하지 않기 때문에 구현할 수 없습니다:
생성된 코드는 Java 1.6에서 컴파일됩니다.
최신 버전을 releases에서 다운로드하세요.
다운로드 후 XML 구성 파일을 생성합니다:
<configuration>
<jdbcUrl>jdbc:oracle:thin:scott/tiger@localhost:1521:xe</jdbcUrl> <!-- jdbc connection string for obridge -->
<sourceRoot>.</sourceRoot> <!-- where to generate sources - related to this configuration file -->
<rootPackageName>hu.obridge.test</rootPackageName> <!-- root Java package, generator builds the directory structure -->
<packages>
<entityObjects>objects</entityObjects> <!-- object types are going to this package -->
<converterObjects>converters</converterObjects> <!-- converter util classes are going to this package -->
<procedureContextObjects>context</procedureContextObjects> <!-- procedure parameter entities are going to this package -->
<packageObjects>packages</packageObjects> <!-- procedure calling utility classes are going to this package -->
</packages>
</configuration>
생성기를 실행합니다:
java -jar obridge.jar -c <obridge-config.xml>
OBridge는 지정된 데이터베이스에 연결하고 필요한 클래스를 생성합니다.
예를 들어 다음과 같은 PL/SQL 코드가 있다고 가정합니다:
Create Or Replace Package simple_procedures is
Function simple_func(a In Varchar2,
b In Out Varchar2,
c Out Varchar2) Return Number;
End simple_procedures;
생성된 소스:
public class SimpleProcedures {
public static SimpleProceduresSimpleFunc simpleFunc(String a, String b, Connection connection) throws SQLException { ... }
}
SimpleProcedures.simpleFunc 메서드를 호출할 수 있습니다:
SimpleProceduresSimpleFunc ret = SimpleProcedures.simpleFunc("hello", "world", conn); // conn is the database connection
반환 객체는 입력 및 출력 매개변수를 Java 유형으로 변환하여 보관합니다.
public class SimpleProceduresSimpleFunc {
private BigDecimal functionReturn;
private String a;
private String b;
private String c;
// getters, setters
}