on 05-01-2006 11:21 PM
Hi All,
I have implemented Asp.net web application and Using SAP .net Connector 2.0 i could pull the data from SAP and displying in browser.Iam using single connection string to
connect to SAP System.
This is working fine. We are planning to move the application to production then the number of user will increase.
In this case do i need to use Connection pool with more user (Connection String)? If i want to implement connection pool how to do it in .Net application.
we are pulling data from one SAP R/3 System,in this case can i use only one connection.if multiple user is accessing my asp.net application how this sap connection will work.
1. How to create connection Pool.
2. How to get the connection from the pool.
Kindly help me out in this regard.
Thanks in Advance.
Regards,
Vijay
HI Vijaya kumar,
conReturn = SAP.Connector.SAPConnectionPool.GetConnectionFromPool(strConnection);
above line for getting a connection from a pool\
if(con2Return !=null)
{
con2Return.PrepareForPooling();
SAP.Connector.SAPConnectionPool.ReturnConnection(con2Return);
con2Return = null;
}
This is what i am working on. I hope this will help you.
plz dont forget to award points if this solves your problem
Regards
ram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ram,
Thanks for your response.
I have some more questions?
1. is one connection string is enough for multiple
user access?in one connection string we can pass one user name and password right.if i have another user name password so i can create another connection string in that case how can i use the connection pool like when do we pass connection string1 and when do we pass connection string 2.
i remember in using JCO in java we can create pool and add as many connection with different connection string then we can get the connection from the pool.
Similarly how can we do in .net.
Defenately i will award point for you.
Regards,
Vijay
Basically Vijay,
public SAP.Connector.Connection conEstablishConnection(string strConnection)
{
SAP.Connector.Connection conReturn;
conReturn = null;
if(strConnection.Trim() !="")
{
conReturn = SAP.Connector.SAPConnectionPool.GetConnectionFromPool(strConnection);
}
return conReturn;
}
public void conReturnConnection(SAP.Connector.Connection con2Return)
{
if(con2Return !=null)
{
con2Return.PrepareForPooling();
SAP.Connector.SAPConnectionPool.ReturnConnection(con2Return);
con2Return = null;
}
}
Establish connection function will provide a connection from pool
conReturnConnection will add to the pool. I hope this will help you in ur work
thanks
ram
To Tarakaram:
Do <b>not</b> call <b>PrepareForPooling()</b> .
To Vijayakumar:
You guess right: Only connection with exactly the same connection string can be reused. This also means that calling Connection.GetConnectionFromPool(connStr) for a new user (a user that was not used before) will return a new connection.
This behavior is necessary, because a user of a connection cannot be changed after connect.
Immagine the connection pools simply as a static hash table of open connections that have been used before, but have not been closed with the connection string as key.
PrepareForPooling is in fact an internal method that is internally called by Connection.ReturnConnection(). It should have been "protected virtual", unfortunately it became "public virtual". The implementation for RFC (in SAPConnection) it closes the user session and creates a clone that is then pushed into the pool. The orinal connection is marked unusable.
If you call it by hand, I'm not 100% sure what will happen. A possible effect is that the Connection Pooling is effectivly disabled.
Hi Ram ,
Same issue araise from my side also, as i build RFC server in VS2003 using sap connectors2.0. I used the RFCServer dll in my .net2005 and make as a service
.net 2005 is acts as a service to SAP Request and back to SAP,
Problem is that i can not able to process multiple SAP system at a time. it will process request only one.
please give the suggestion.
how do i handle multiple request from SAP systems,
If we build RFCServer property Proxytype as server, code genreated automatically.
I think you forget to make it as question. please ask moderator to make it a question.
regards
ram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.