How to use a connection across multiple request

What is the idea of using a connection across multiple requests.

Please give more details. What connections and what requests
And are you posting on the right forum? (This sounds more like a Networking/servlet question)

Similar Messages

  • How to retain socket connection for multiple requests in java 1.3

    Hi All,
    My problem is to retain client socket connection without opening and closing socket connection for every request.I want to open the socket connection once and send multiple requests one after the other based upon the response over the same socket.Finally I want to close the socket only after completing all my requests and receiving respective responses.I don't want to open and close the socket for each request and response.While at the same time I expect the socket to send each request only after receiving the response for the previous request.
    I am using java 1.3 and I am looking for the solution in same version.
    Please help me .
    Thanx in advance.

    Look at my response to "Telnet to Unix box from Java"
    http://forum.java.sun.com/thread.jsp?forum=31&thread=437231
    on "Java Programming" forum. It does exactly that to run the signon and a command. It would be easy to extend it to do multiple commands.

  • How to identify a user across multiple pages

    Hi,
    I'm doing a homebanking and I would like to know how to identify a user across multiple pages.
    I have already take a look at HTTPSESSION, but I didn't understand.
    Can someone help me.
    I'm send the servlet Logon.
    import java.io.*;
    import java.sql.*;
    import java.util.Date;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class Cons_logon extends HttpServlet
         private Connection conexao = null;
         Login1 login1;
         public void init (ServletConfig cfg) throws ServletException
              super.init(cfg);
              try
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                   conexao = DriverManager.getConnection("jdbc:odbc:bank");
              catch (Exception e)
                   System.out.println(e.getMessage());
         public void doPost (HttpServletRequest req,
    HttpServletResponse res)
    throws ServletException, IOException
              String Suser, Spassword;
         PrintWriter out;
              res.setContentType("text/html");
    out = res.getWriter();
    String opcao = req.getParameter("log");
    Thanks

    I would recommend using the authentication mechanism that's guaranteed by the servlet spec. If you do that, you can just call
    request.getRemoteUser()
    to get the user name across multiple pages.
    If you want to use your own login scheme, you can create a new session object and map it to a user name somewhere in your app. Or you can just put the name of the user on the session. But the preferred way is to use the default authentication scheme defined by the spec.

  • How to use JDBC Connection Pools in a standalone application?

    Hi, there,
    I have a question about how to use JDBC Connection Pools in an application. I know well about connection pool itself, but I am not quite sure how to keep the pool management object alive all the time to avoid being destroyed by garbage collection.
    for example, at the website: http://www.developer.com/java/other/article.php/626291, there is a simple connection pool implementation. there are three classes:JDBCConnection, the application's gateway to the database; JDBCConnectionImpl, the real class/object to provide connection; and JDBCPool, the management class to manage connection pool composed by JDBCConnectionImpl. JDBCPool is designed by Singleton pattern to make sure only one instance. supposing there is only one client to use connection for many times, I guess it's ok because this client first needs instantiate JDBCPool and JDBCConnectionImpl and then will hold the reference to JDBCPool all the time. but how about many clients want to use this JDBCPool? supposing client1 finishes using JDBCPool and quits, then JDBCPool will be destroyed by garbage collection since there is no reference to it, also all the connections of JDBCConnectionImpl in this pool will be destroyed too. that means the next client needs recreate pool and connections! so my question is that if there is a way to keep pool management instance alive all the time to provide connection to any client at any time. I guess maybe I can set the pool management class as daemon thread to solve this problem, but I am not quite sure. besides, there is some other problems about daemon thread, for example, how to make sure there is only one daemon instance? how to quit it gracefully? because once the whole application quits, the daemon thread also quits by force. in that case, all the connections in the pool won't get chance to close.
    I know there is another solution by JNDI if we develop servlet application. Tomcat provides an easy way to setup JNDI database pooling source that is available to JSP and Servlet. but how about a standalone application? I mean there is no JNDI service provider. it seems a good solution to combine Commons DBCP with JNID or Apache's Naming (http://jakarta.apache.org/commons/dbcp/index.html). but still, I don't know how to keep pool management instance alive all the time. once we create a JNDI enviroment or naming, if it will save in the memory automatically all the time? or we must implement it as a daemon thread?
    any hint will be great apprieciated!
    Sam

    To my knoledge the pool management instance stays alive as long as the pool is alive. What you have to figure out is how to keep a reference to it if you need to later access it.

  • How to use a connection ODBC in  crystal reports viewer?

    Hi Guys!
    I need to know if for update a report in crystal reports viewer, is necessary, have a connection SAP Business Objects Business Intelligence. How to use a connection ODBC in  crystal reports viewer?

    Hi Guys!
    I need to know if for update a report in crystal reports viewer, is necessary, have a connection SAP Business Objects Business Intelligence. How to use a connection ODBC in  crystal reports viewer?

  • How to use the 'Decision between multiple alternatives' Process variant

    Hi ,
    Can anyone tell me how to use the 'Decision between multiple alternatives' Process variant in BI 7 Process chains ?
    The requuirement is that I have a DSO eg DSO 1 from which i have to load DSO 2 and DSO 3 . Now if the number of Records in DSO 1 are < 100 i will load DSO 2 from DSO 1 else i will load DSO 3 from DSO 1 .
    So in the PC i have used a 'ABAP Program' variant (which counts the number of rows in DSO 1) after loading DSO 1 and  after this 'ABAP Program' Variant , i have used the 'Decision between multiple alternatives' Process variant. Problem is it is giving me only some some system fields in the formula , like sy-datum or sy-timlo , which are of no use here .
    It would be great if i can receive some help here .
    --Devraj

    in RSPC you create a ABAP processing type "ending with specific values".
    We use true or false for things as you specify.
    your abap program should return a true or a false to indicate which of the situations is applicable.
    Is this helpful?
    Marco

  • How to share a session across multiple jws?

    Hi!
    I have this problem.
    I'm looking for a way to have shared sessions, available across multiple JWS with WLW 8.1
    I try to get a session with this code:
    WebServiceContext wsContext = WebServiceContext.currentContext(); WebServiceSession session = (WebServiceSession)wsContext.getSession();
    but it throws COntextNotFoundException....
    I added the session descriptor in weblogic.xml to set the param CookiesEnabled to true, because I read that using this code works but requires that the client support cookies to keep the HttpSession object around.
    But it's not works!
    How can I get to HTTP session from a JWS?
    And....it's possible to share a session accross multiple JWS?
    Thanks a lot!

    You may be interested (& probably discouraged at the end) in this discussion http://forum.java.sun.com/thread.jspa?threadID=619170
    cheers,
    ram.

  • How to create a variable, and how to use the same across all the reports?

    Hi,
    Is there any possibility of creating a variable at once and making use of that across in all the Crystal Reports?
    Thanks In advance for your time and solution.

    MohanMRK,
    can you describe how you get the value for this variable?
    is it calculated on one report and then you want to pass it to a 2nd report? if that's the case, what you can do is have the reports linked via an opendocument link and pass the value to the 2nd report as a parameter. the value / parameter is only shared when you press the opendocument hyperlink.
    please see the sdk library [here |http://www.sdn.sap.com/irj/boc/sdklibrary]and scroll down to the opendocument section near the bottom.
    if you are just trying to find a way to share a calculation across reports look into creating a Custom Function which can be added to your repository. please note that this will not pass a calculated value across 2 or more reports, but will just have a shared method of making the calculation.
    as Abhilash mentioned before, there's no way to use an actual Variable across 2 separate reports without them being a main report and subreport(s). in that case you'll want to look into Shared Variables.
    cheers,
    jamie

  • How to use single connection

    Hello Gurus,
    I am new in adf and using jdev 11.1.2.3.
    I am developing application in which i am using dynamic shell UI. The structure of application is i have one main application modules with the UI shell. The other modules are developed in separate application and has its own data control and task flows and then i deployed them as adf library. Then i am consuming the task flow in the main application.
    As i mention each module has its own data control, so when i open a module it makes new connection with database. It means if i have opened ten modules then it is opening ten connections with database.
    Is is possible i can configure somewhere to use single connection for all modules and not to open the connection for each module.
    And one more thing if i undeploy the application the connection is still with database as v$session view shows it. How i can close connection if i close the tab in ui shell.
    Thanks,

    Hi, You can explore the option of nesting your AM.  Check below links to know more about them.
    Decompiling ADF Binaries: What you may need to know about Nested Application Module
    Nested application modules | ADF KickStart
    Good luck !

  • How to use the method getParameterValues() of request object in JSP?

    I'm trying to use the method
    String a[]=request.getParameterValues("ch_box");
    to retrieve the values from the form
    but it gives the error
    "Method getParamaterValues(java.lang.String) not found in interface javax.servlet.http.HttpServletRequest."
    so plz tell me how to overcome this hurdle?
    thanx

    Well, just one note... either you have a typo in your code, or else in your post.
    If you cut and pasted the error message (which it looks like you did), then the method getParamaterValues() should be getParameterValues() instead (notice the spelling difference), so you probably just have a typo in your code.

  • How to use pool connection run oracle procedure?

    Hi, All:
              I am facing a difficulty I can not find the solution. Maybe you can help
              me.
              I want to call an oracle stored procedure whenever I talk to datebase to
              make the application more efficient. I was able to run the procedure using
              oracle thin driver but not the connection pool using Weblogic jDriver for
              JDBC2.0.
              Please check the following code and see what I did wrong:
              The code in JSP file in Weblogic:
              <%-- JSP page directive --%>
              <%@ page
              import="java.io.*,java.util.*,java.sql.*,weblogic.common.*,weblogic.jdbc20.c
              ommon.*" %>
              <%-- JSP Declaration --%>
              <%!
              protected Connection con = null;
              ResultSet rset = null;
              %>
              <%-- JSP Scriptlet --%>
              <% try {
              Properties props = new Properties();
              props.setProperty("user", "james");
              props.setProperty("password", "aimjames");
              Driver myDriver =
              (Driver) Class.forName
              ("weblogic.jdbc.pool.Driver").newInstance();
              con = myDriver.connect("jdbc:weblogic:pool:hdj2Pool", props);
              String userid = (String)session.getAttribute("user.id");
              int subid =
              Integer.parseInt((String)session.getAttribute("sub.id"));
              String query = "begin pkg_select.sel_req_in_001(" + userid +
              ", " + subid + ", ?); end;";
              weblogic.jdbc.common.OracleCallableStatement cstmt =
              (weblogic.jdbc.common.OracleCallableStatement)con.prepareCall(query);
              cstmt.registerOutParameter(1,java.sql.Types.OTHER);
              cstmt.execute();
              rset = cstmt.getResultSet(1);
              When I run this JSP file, the compilation is fine but the result shows
              nothing. That's means I can not get the ResultSet for some reason.
              The working file when I use oracle thin driver (NOT use a connection pool):
              String userid = (String)session.getAttribute("user.id");
              int subid = Integer.parseInt((String)session.getAttribute("sub.id"));
              String query = "begin pkg_select.sel_req_in_001(" + userid +", " +subid
              +", ?); end ";
              CallableStatement cstmt = con.prepareCall(query);
              cstmt.registerOutParameter(1,OracleTypes.CURSOR);
              cstmt.execute();
              ResultSet rset = (ResultSet)cstmt.getObject(1);
              You may notice that I am trying to bind a parameter to an Oracle cursor. Is
              there anything I did wrong in using weblogic API? I just want to let you
              that in the weblogic JSP file, I also tried to use
              weblogic.jdbc.oci.CallableStatement and
              weblogic.jdbc20.oci.CallableStatement instead of
              weblogic.jdbc.common.OracleCallableStatement, but none of them seems work.
              I did check the bea site at
              http://www.weblogic.com/docs51/classdocs/API_joci.html#1080420 for the
              example to use:
              cstmt.registerOutParameter(1,java.sql.Types.OTHER);
              and I think I followed the exact procedure the example did.
              Please help!
              James Lee
              Artificial Intelligence in Medicine, Inc.
              2 Berkeley Street, Suite 403
              Toronto, Ontario M5A 2W3
              Tel: 416-594-9393 ext. 223
              Fax: 416-594-2420
              Email: [email protected]
              

    Joseph
    Thanks for the suggestion about latest version of Weblogic Server.
    "coding best-practices" is not mentioned in the post.
    In order to make servlet application run significantly faster, my servet how to use connection poo is much moreresonable?
    It is reasonable to expect servlet to run significantly faster with connection pooling.
    Is it true that geting and close a connection whenever
    one time database access finished?
    Already answered. Applications use a connection from the pool then return it when finished using the connection.
    Will the solution affect the servlet performance?
    Yes. Already answered. Connection pooling enhances performance by eliminating the costly task of creating database connections for the application.
    Is there any official document to introduce connection pool program?
    For the latest version
    http://download.oracle.com/docs/cd/E17904_01/web.1111/e13726/toc.htm
    http://download.oracle.com/docs/cd/E17904_01/web.1111/e13737/jdbc_datasources.htm#insertedID0

  • How to use an Applet with multiple-jars

    Hi everybody,
    I would like to use an applet with multiple-jars.
    ex:
    <applet codebase="." archive="main.jar,Addon1.jar,Addon2.jar" code="Appl.class" id="MyTest" width="600" height="30">
         <param name = "MyParam" value = "1;2">
    </applet>
    An applet with :
    -> 1 Main JAR
    -> X Addon JARs (X : a parameter "PRM")
    My main part knows the parameter "PRM" -> knows which addon to use
    My question is, how do I use classes from addons, inside the main part (and vise-versa if possible) ?
    Thanks in advance
    Best regards

    I try what you say :
    === HTML ===
    <applet codebase="." archive="Main.jar,Addon1.jar" code="Test.Appli.class" id="MyTest"  width="600" height="30">
         <param name = "myPrm1" value = "1;2">
    </applet>=== MAIN JAR ===
    package retest;
    interface InterfAddOn1 {
        public void AfficheTest1(String sStrTest);
    public class Ctest {
        public Ctest() {}
        public void unTest(String sClassNameR) {
          String sClassName = "PackTestAddon.TestClass1";
          try {
              Object oObj = Class.forName(sClassName).newInstance();
              ((InterfAddOn1) oObj).AfficheTest1(" Hello World ");
          } catch (ClassNotFoundException ex1) {
              System.out.println("ERR Class not found");
          } catch (IllegalAccessException ex1) {
              System.out.println("ERR Illegal Access");
          } catch (InstantiationException ex1) {
              System.out.println("ERR Instantiation Exception");
    }=== ADDON JAR ===
    package PackTestAddon;
    public interface InterfAddOn1 {
        public void AfficheTest1(String sStrTest);
    package PackTestAddon;
    public class TestClass1 implements InterfAddOn1 {
        public TestClass1() {}
        public void AfficheTest1(String sStrTest) {
          System.out.println("Test :"+sStrTest);
    }I have this error :
    Exception in thread "AWT-EventQueue-2" java.lang.ClassCastException: PackTestAddon.TestClass1
         at retest.Ctest.unTest(Ctest.java:58)
         at retest.Appli.actionPerformed(Appli.java:442)
         at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
         at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
         at java.awt.Component.processMouseEvent(Unknown Source)
         at javax.swing.JComponent.processMouseEvent(Unknown Source)
         at java.awt.Component.processEvent(Unknown Source)
         at java.awt.Container.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)
    I don't really know why ... =;o(
    Helppppp ... Thanks in advance.

  • How to use persistent connections in HTTP on Client Side

    I want to Open a Single HTTP Connection and Post Multiple Requests on that connection to the Server. Please give code examples and please tell can i do it with the HttpURLConnection Class.

    i think u can do this by creating threads of code that will be sending the requests.

  • How I use standar Workflow "Approve Travel Request"?

    Hi,
    I implemented in ESS the "trips and Expenses" option run correctly, but I dont know how I use(or active) workflow (when section in IMG for example)
    I found the link
    http://help.sap.com/saphelp_erp60_sp/helpdata/en/04/928bc146f311d189470000e829fbbd/content.htm
    but I dont know web, please excuse me if  the question is beginner
    thanks for your posts and helps
    Ivan

    hi Arghadip and Any
    I reviewed the inbox in sender of the  travel request
    http://img28.imageshack.us/img28/3489/inbox.jpg
    I entered log the message and workflow
    http://img175.imageshack.us/img175/5951/workflowlogtripnoagents.jpg
    It shows message "no agents"
    http://img198.imageshack.us/img198/6858/workflowtrip.jpg
    http://img208.imageshack.us/img208/853/workflowlogtrip.jpg (View of the workflow)
    Sometime ago in my SAP system implemented the workflow "Leave Request" (implementation is succesful)
    http://img411.imageshack.us/img411/7945/workflowleave.jpg (Inbox the sender of the leave request)
    http://img514.imageshack.us/img514/8268/workflowleaveagents.jpg (the leave requests included agents)
    sometimes ago, In my sap systeme implemented the "leave request", at the beginning of the implementation required this action:
    <i><b>
    To copy the standard workflow, go to transaction PFTC.
    Select the task type u201CWorkflow templateu201D and enter the workflow number in the task number. Click on u201CCopy tasku201D.
    WS12300111
    </b></i>
    I can apply the same in my travel request? how?
    in my Agent grid in the workflow of "Travel Request" shows agent WF-batch
    http://img638.imageshack.us/img638/8432/agentswf.jpg
    In case of the "leave request" shows wf-batch and Manager (Quiroz) definided en the PPOME
    http://img532.imageshack.us/img532/4/agentswfleaverequest.jpg
    How I use the workflow template? (in my case is WS200000050)
    thanks your post and help
    Ivan

  • How  to reuse common code across multiple work repositories

    Hi Experts,
    I have a ruqirements from our customer side. we have a one master repository attached with three work repositories(wk1,wk2,2k3). Customer want to place some common code into wk1 workrepository and want to reuse across multiple workrepositories(wk2,wk3).
    Generally we can reuse code in same work repositories like knowmodules and interfaces.
    Is it possible to use across mutiple workrepositories?
    Thanks in Advance
    Siri

    You can't hare the same instance of the code across multiple work repositories. You have to have a seperate instance in each work repository. However you can manage it as if it was shared through ODI's versioning capability i.e. all changes to the common code are only ever made in one work repository i.e. Wk1 and then deployed to the other 2 which is as simple as getting the latest version from the Master repository. You could even set up security in Wk2 and Wk3 to make sure that your developers/users do not have permission to edit the common code in those repositories.

Maybe you are looking for

  • Can't make photoshop droplets w/ Mac Book Pro.

    I was going to re-do my actions and droplet sets for my MacBook Pro yesterday since it has a new destination disk and got a big surprise. While I could do my actions OK, all I get when I build a droplet off of it is the icon and grey and white circle

  • Clear Parameter ID Problem...

    Hi Gurus; I write a screen program(dialog). I use structure on the screen because its very easy. My structure's some field's data element has parameterId. For example Matnr>MAT , Equipment>EQN. Sometimes I want to clear my structure in runtime. I cle

  • User Exit for Aleau Idoc

    Hello everybody. We have the next scenario: JDBC--->PI-(iDOC)-- >SAP SAP---->PI-(ALEAUD)-->JDBC We sent a Orders Idoc to SAP. In this Idoc we have informed the field BELNR (Purchase number) and I need to get this number in the ALEAUD Idoc. The proble

  • Serial number not accepted lightroom MAC but works on windows

    loaded a test version of lightroom on MAC. Tried to add the serial number but number was not accepted. Installed Lightroom on Windows PC and entered the serial number and this works fine. Why can I not add the same number on my MACbook?

  • URL Blue Bar but no Website

    I downloaded Safari 1.2 successfully; however, when I type in a URL address or click on the preset pages no webpage appears.