Yes, it is definitely possible to do this with JNDI datasources. The fact that the datasource comes from JNDI is pretty much irrelevant, once you've got the reference to it, it's no different to any other datasource.
Can you give some details on your configuration? From the linked thread it looks like you're using Weblogic, which version? Spring version?
The snippets below are from Spring 2.0.6 on Weblogic 8.1sp6. It's a slight variation on the version of my previous post above.
The below is from the applicationContext.xml file to configure the datasource. jdbc/myDataSource is configured as a datasource in the Weblogic console (driver class is 10g oracle.jdbc.OracleDriver from ojdbc14.jar)
Code:
<bean id="requestDAO" class="com.mycompany.dao.OracleRequestDAO">
<property name="dataSource" ref="dataSource" />
</bean>
<jee:jndi-lookup id="dataSource" jndi-name="jdbc/myDataSource" />
Here's the code from requestDAO to use a clob...
Code:
public class OracleRequestDAO extends JdbcDaoSupport implements RequestDAO {
public final void saveRequest(final CCRequest request, final String xmlReq) {
// Create the SQL statement to store the data.
String sql = "UPDATE request SET z = XmlType(?), updated_at = SYSDATE WHERE x = ? AND y = ?";
Object[] params = new Object[] {
new SqlLobValue(xmlReq, new OracleLobHandler()),
request.getX(),
request.getY()
};
int[] types = new int[] {
Types.CLOB,
Types.VARCHAR,
Types.VARCHAR
};
// Store the request
getJdbcTemplate().update(sql, params, types);
}
}
This is all I needed to get this working.
I didn't need to use a native jdbc extractor at all for this to work with WLS8 and Oracle 10.2.0.X.
Just guessing but could it be a classpath issue? Do you have the spring and/or Oracle jdbc driver libraries in the wrong place? Or in more than one place? In the application above, the ojdbc14.jar file is only in C:\bea\weblogic81\server\lib and the spring jar is packaged in the EAR file.