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]

Reply via email to