Locally everything works fine, but on a remote Weblogic not really. The next code runs without any exception.
try
{
ods = new OracleDataSource();
connectionString = XmlReader.getConnectionString();
ods.setURL(connectionString);
}
catch (SQLException ex)
{
ex.printStackTrace();
}
catch (Exception e) {
e.printStackTrace();
}
When i call getConnection() on the previous ods object, it doesnt raise any exception
try
{
if (connection == null || connection.isClosed()) {
connection = ods.getConnection();
}
}
catch(Exception e) {
e.printStackTrace();
}
But finally the connection object is null for example after calling this
CallableStatement cstmt = connection.prepareCall( jobquery );
On a database it looks like the application created the connection, but then it doesnt call the procedure specified in "jobquery". What could be wrong?
Simply my question is: Is there a way to create an OracleDataSource without an exception, and then get a null from it?
Unless you miss some code in original question, it seems you didn't perform execute().
Example:
callableStatement.executeQuery();
Read this CallableStatement tutorial
Nambaris answer will probably solve your immediate issue. Other points to consider:
These are not directly related to your problem, just things you should be doing in the long run.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.