cancel
Showing results for 
Search instead for 
Did you mean: 

Method getConnection() is not supported by Open JDBC

raj_balakrishnan3
Participant
0 Kudos

Hello all,

I am developing a webdynpro application which accesses a set of database tables. These tables were created using Java Dictionary and has been successfully deployed. I have the data-sources-aliases.xml file in the META-INF folder. <?xml version .... <data-source-name>${com.sap.datasource.default}</data-source-name><alias>SIA_DS</alias> ... </data-source-aliases>

But when I try to get a db connection, the app returns with the below error.

Method getConnection() is not supported by Open JDBC

I am using

InitialContext context = new InitialContext();

DataSource ds = (DataSource) context.lookup("jdbc/SIA_DS");

return ds.getConnection();

to get a connection.

How do I fix this? Is there something else I am missing?. Thanks

Raj Balakrishnan

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi

See this thread

Kind Regards

Mukesh

raj_balakrishnan3
Participant
0 Kudos

I fixed it on my own. Just to let you know what happened.

I had a method to close the connection as below

protected static void closeDbResourcesQuietly(Statement stmt) {

if (stmt != null) {

try {

Connection con = stmt.getConnection();

stmt.close();

closeDbResourcesQuietly(con);

} catch (SQLException e) {

// Donot report since it is a quiet method e.printStackTrace();

}

}

}

Apparently in OpenJDBC, the statement stmt.getConnection() is not supported. I commented out that and it worked fine.