Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> access non-oracle database from java oracle stored procedure
Is there any way to use non-oracle database driver from the inside of Java
Oracle Stored Proc?
Working on import procedure I'm trying to connect to Paradox database using JDBC-ODBC Bridge. It works fine if I'm running my java class as a java application, but it cannot connect to Paradox if I'm running it as a Java Stored Procedure.
begin
:v := apps.ImportTimeSheet.getValue;
end;
the result is:
Result = drv=sun.jdbc.odbc.JdbcOdbcDriver_at_529a1f68 java.sql.SQLException: found null connection context; sqlState=08003
package imp;
import java.sql.*;
import sun.jdbc.odbc.JdbcOdbcDriver;
public class TimeSheet {
public static String getValue(){
String url = "jdbc:odbc:importItime";
String result = "";
try{
DriverManager.registerDriver(new sun.jdbc.odbc.JdbcOdbcDriver());
Driver driver = DriverManager.getDriver(url);
result = driver == null ? "driver is null " : "drv=" + driver.toString() + " ";
result += "trying to get Connection: ";
Connection connection = DriverManager.getConnection(url);
} catch (SQLException e){
result += e.toString() + "; sqlState=" + e.getSQLState();
}
return "Result = " + result;
}
}
CREATE OR REPLACE PACKAGE ImportTimeSheet AUTHID CURRENT_USER AS FUNCTION getValue RETURN VARCHAR2; END ImportTimeSheet;
CREATE OR REPLACE PACKAGE BODY ImportTimeSheet AS FUNCTION getValue RETURN VARCHAR2 AS LANGUAGE JAVA NAME 'imp.TimeSheet.getValue() return java.lang.String'; END ImportTimeSheet;
![]() |
![]() |