on 06-08-2005 7:43 AM
Hello,
Let's say I have 5 different views in a certain component.
I would like to open a connection to a DB and share this connection between all views.
Can somone please show/explain me where do I do it on the component and how do I access this connection from the views?
Hi
create a method in component controler open the connection there and release the connection once it is finished and call this contoller method from any view u want.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Roy,
If u r creating the connection in a method in component controller it is only as good as creating it in each view. Evry time u call the function in a view a new connection wil be created.. You will not be sharing a single connection in this case !
Is ur requirement satisfied.. how did u do the whole process.. bcoz connections are transient ! and u might have to re-create them whenever it is not available..
Regards
Bharathwaj
Message was edited by: Bharathwaj R
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Roy,
For getting the connection, you can create the datasource in the "Visual Administrator" and you can get the connection from the datasource. By doing this, you can retrive the connection from the connection pool.
Refer the link to create the datasource and accessing it from the java code.
http://help.sap.com/saphelp_nw04/helpdata/en/82/fdbf2085f65f43a71e755fc904478d/frameset.htm
"How to Use SAP J2EE Database Pooling Service"
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/stu/use sap j2ee database pooling service
If you need any further clarification let me know.
Regards,
Santhosh.C
Hi Roy,
Create the connection in the component controller itself. There will be only one instance of that connection in the whole component.. If u just map it and and use this variable to create a statement and execute it ,the connection should work.
we dont have to activate anything here....
Regards
Bharathwaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Roy,
How about creating a context attribute of (java native type)java.sql.Connection type and use it in the component controller .
Open the connection in the component controller and set it to the connection attribute you have created...
Finally map it to all the views.
Regards
Bharathwaj
Message was edited by: Bharathwaj R
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Connect thru the Controller, and make use of this in ur views.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.