• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: EOF problems
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: EOF problems


  • Subject: Re: EOF problems
  • From: David Teran <email@hidden>
  • Date: Sat, 6 Nov 2004 16:28:29 +0100

Hi Damien,

about your 'too much connections' problem: is it possible to change Connection properties without closing the connection? You could call this

EOUtilities.rawRowsForSQL(eoEditingContext,"WDLParameter",storedFuncti on,null);

in session.awake()
and make sure that you are pooling the EOF stacks. Take a look at ERExtensions, Anjo and i have implemented pooling of EOF stacks. You can enhance it to allow access to one stack by only one thread. I am pretty sure pooling is possible in your situation.


If not, open and close the stacke in session.awake and session.sleep but make sure you do not use EO's after one "rr loop".

Why are you using special SQL with this setSourceSQL() method? What is so special about this SQL? If you want EOF to do special stuff you can check the delegate method

databaseContextWillPerformAdaptorOperations(EODatabaseContext dbCtxt,NSArray adaptorOps,EOAdaptorChannel adChannel)

Check the adaptorOps and return a NSArray with the ops you do not want to handle by your own. For those which need custom SQL: remove them from the array - do not return theses adaptorOps, instead analyze them and write custom SQL, use a dedicated SQL connection to the database, not EOF. You should also use ERExtensions as you can always call ERExtensions.session() to get the WOSession attached to the current thread.

Contact me directly if you need further assistance, its not a question about 'fighting' against something, its just about 'knowing how to do it'. I cannot hear this fighting stuff any more, there is no tools-war!

EOF is very flexible, for example one of our customer said that we have to use special stored procedures in Oracle, but not the way EOF calls stored procedures, they said EOF is calling the stored procedures in a 'non acceptable way' :-) OK, fine, then we catch up the adaptor operations and call the Stored Procedure by hand with JDBC, why not!? Our customer explained us why they were using stored procedures and all that stuff and i must admit in -their- situation it was the best way to do it.

cheers David



Am 05.11.2004 um 14:30 schrieb Damien Lust:


In webobjects , each user share the same connection and use a defaultEditingContext to execute request on DB.


In my case, i must use a unique connection for each user because his connection must be unique (my connection use of a workSessionToken , for each request a trigger tests if the workSessionToken is correct, the DB has been developed by my client)

Code that set the EOEditingContext

String storedFunction = "{ call PK_ACCESS_CONTROL.setCurrentWorkSession('"+workSessionToken+"')}"; // Param returned from another procedure that create a workSessionToken from a login and password
EOUtilities.rawRowsForSQL(eoEditingContext,"WDLParameter",storedFuncti on,null);
session.setDefaultEditingContext(eoEditingContext);



So if the number of user grows (more than 100), the number of connection grows , so it cans generate problems with space memory/resources for the DB (Oracle)



I have some problems

- Objects I manipulate are complex (use of nested table that can content another nested table, or a type of XML.TYPE,...) , i have a eomodel for my objects but not very useful ( i use it to retrieve name) , i use EOUtilities.rawRowsForSQL() to execute my SQL request / (it can be a call of procedure) . My class is "hybrid" , some method use eof and other are very similar of a jdbc approach

Exemple:
-------------

//EOF
public String name() {
		return (String)storedValueForKey("name");
	}

// Like a JDC approach
public String setSourceSQL() {
return "UPDATE " + TABLENAME + " SET SOURCE=" + this.mainDBSchema() + ".T_SOURCE('" + sourceTypeName + "',"
+ sourceDefinition + ",'" + sourceViewName + "') WHERE KEY=" + key().toString();


}

public void setSource(String sourceTypeNameValue, int sourceDefinitionValue, String sourceViewNameValue) {

		sourceChanged = true;
		sourceTypeName = sourceTypeNameValue;
		sourceDefinition = new Integer(sourceDefinitionValue);
		sourceViewName = sourceViewNameValue;

}


public void save(EOEditingContext ec) {
ec.saveChanges();

if (sourceChanged) {
EOUtilities.rawRowsForSQL(ec, "DLQTModel", setSourceSQL(), new NSArray());
sourceChanged = false;
}
if (creationTimeStampChanged) {
.....
}




- To decrease the number of connection, i would like to open a connection to the DB at the begin of the request-response loop, and to close it a the end. I don't know how to do it.

- I have always 2 connections opened for one user , i don't know when the second is created. Is there a way to know, the number of current connection?


Thanks.

_______________________________________________
WebObjects-dev mailing list
email@hidden
http://www.omnigroup.com/mailman/listinfo/webobjects-dev


_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Prev by Date: Re: EOF inserts PK automatically
  • Next by Date: WO451 Sybase EOAdaptor sources
  • Previous by thread: Re: EOF problems
  • Next by thread: O-R Mapping Article in Software Dev Times
  • Index(es):
    • Date
    • Thread