Thanks for the tip!
It was a partial success - I created a custom plugin and registered it
with the EOModel, and now connectionProperties() has changed to
reflect my additions.
However, the properties are not getting picked up by the driver, I'm
not sure why.
If anyone has any experience modifying the connection properties of an
Oracle connection, I would love some insight.
For future reference, here are the properties I'm changing....
/**
* Adds our Oracle specific connection properties.
*
* @author Hugi Þórðarson
* @reviewedby [TODO]
*/
@Override
public Properties
connectionPropertiesForConnectionDictionary( NSDictionary
nsdictionary ) {
Properties properties =
super.connectionPropertiesForConnectionDictionary( nsdictionary );
if( properties != null ) {
logger.debug( "Registering Oracle specific JDBC connection
properties." );
properties.put( "oracle.jdbc.ReadTimeout", 60000 );
properties.put( "oracle.jdbc.mapDateToTimestamp", false
);
}
return properties;
}
Cheers,
- Hugi
// Hugi Thordarson
// http://hugi.karlmenn.is/
On 19.5.2009, at 17:33, JR Ruggentaler wrote:
Try extending the DB specific plugin, for example the code below
sends two properties (v$session.program, v$session.process) to
Oracle providing an actual Application name and PID. Normally the
DBA see generic information like JDBC Client and no PID.
import java.util.Properties;
import com.mpv.foundation.System_Additions;
import com.webobjects.foundation.NSDictionary;
import com.webobjects.jdbcadaptor.JDBCAdaptor;
import com.webobjects.jdbcadaptor.OraclePlugIn;
public class MPVOraclePlugIn extends OraclePlugIn {
public MPVOraclePlugIn(JDBCAdaptor adaptor) {
super(adaptor);
}
public Properties
connectionPropertiesForConnectionDictionary(NSDictionary
nsdictionary) {
Properties properties =
super.connectionPropertiesForConnectionDictionary(nsdictionary);
// Oracle specific properties
if (properties != null) {
String pid = "" + System_Additions.processID();
String processName = System_Additions.processName();
// NSLog.out.appendln("MPVOraclePlugIn: process name: " +
processName + " pid:" + pid);
if (null != processName) {
properties.put("v$session.program",
processName);
}
if (null != pid) {
properties.put("v$session.process", pid);
}
}
return properties;
}
}
On May 19, 2009, at 12:17 PM, Hugi Thordarson wrote:
Hi all.
I need to set a property for the Oracle JDBC-driver, can anyone
tell me how to do that?
This is wat I've tried (without success):
---------
EOModel model = EOModelGroup.defaultGroup().modelNamed( "MyModel" );
EODatabaseContext dbc =
EODatabaseContext.registeredDatabaseContextForModel( model, ec );
JDBCAdaptor adaptor = (JDBCAdaptor)dbc.adaptorContext().adaptor();
adaptor.connectionProperties().put( "oracle.jdbc.ReadTimeout",
5000 );
System.out.println( adaptor.connectionProperties() );
---------
The last line's sysout will not show the newly added property -
any idea how I can get it in there?
Cheers,
- hugi
// Hugi Thordarson
// http://hugi.karlmenn.is/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/jr%40mpv.com
This email sent to [email protected]
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]