Repost-Best way of using connection pooling

I am reposting this, seems best suitable in this category.
I am using Eclipse 3.1 along with Tomcat 5.0, MySQL 4.1, J2EE1.4. I could set up the JNDI Dataresource connection pooling and tested with small test servlet. Now thinking of having common methods for getting connection / closing / commiting ....etc.
I wrote following. [Please let me know whether it is correct way of doing it - as i am not very sure]
package common;
import java.sql.*;
import javax.sql.*;
import javax.naming.*;
import org.apache.log4j.Logger;
public final class connectionManager {
     private static Logger logger = Logger.getLogger(common.connectionManager.class);
     public connectionManager() {}
     public static Connection getConn () throws NamingException, SQLException
//JNDI DataSource connection pooling
          Connection conn = null;
          try{
               Context initContext = new InitialContext();
               Context envContext  = (Context)initContext.lookup("java:/comp/env");
               DataSource ds = (DataSource)envContext.lookup("jdbc/TQ3DB");
               conn = ds.getConnection();
          }catch (NamingException ne) {
              new GlobalExceptionHandler(logger, ne);
               conn = null;
               throw new NamingException();
          }catch (SQLException e){
               new GlobalExceptionHandler(logger, e);
               conn = null;
               throw new SQLException();
          return conn;
       }//getConnection
     public static void commit(Connection conn) throws SQLException
          conn.commit();
     public static void rollback(Connection conn) throws SQLException
          conn.rollback();
       public static void setAutoCommit(Connection conn, boolean autoCommit)
                                    throws SQLException
            conn.setAutoCommit(autoCommit );
     public static void closeConnection(Connection conn) throws SQLException{
          if (conn != null) {
               conn.close();
               conn = null;
     }//closeConnection
     public static void closeResources(ResultSet oRS, PreparedStatement pstmt) throws SQLException
          if (oRS != null) {
               oRS.close();
               oRS = null;
          if (pstmt != null) {
                    pstmt.close();
                    pstmt = null;
     } // closeResources
}//ConnectionManager
I am having a login form which submits user name and password. I am checking this against the database. Following is the servlet to do that.
package login;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import common.*;
public class loginServlet extends HttpServlet {
     public void doGet(HttpServletRequest request, HttpServletResponse response)
               throws ServletException, IOException {          
          doPost(request, response);
     }//doGet
     public void doPost(HttpServletRequest request, HttpServletResponse response)
               throws ServletException,IOException{
          String userId = request.getParameter("userId");
          String password = request.getParameter("password");
          ** call a method to validate the password which will return the
          ** User Name for authorized users and null string for un-authorised.
          String uName = validateUser(userId, password);
          //if uName is null .. user is not authorized.
          if (uName == null){
               //redirect to jsp page with error message
              RequestDispatcher rd =
                   getServletContext().getRequestDispatcher("/jsps/mainmenu.jsp");
              if (rd != null){
                   rd.forward(request,response);
          else{
               // the user is valid - create a seesion for this user.
               HttpSession userSession = request.getSession(true);
               // put the user name session variable.
               userSession.setAttribute("userName", uName);
               //redirect to Main menu page
               RequestDispatcher rd =
                    getServletContext().getRequestDispatcher("/jsps/mainmenu.jsp");
               if (rd != null){
                    rd.forward(request,response);
     }// end of doPost
     private String validateUser(String userId, String password)
               throws SQLException{
          String returnVal = null;
          connectionManager cm = new connectionManager();
          Connection conn = null;
          PreparedStatement pstmt = null;
          ResultSet oRS = null;
          try{
               //get the connection
               conn = cm.getConn ();
               //get records from user table for this user id and password
               String sQry = "SELECT  user_login FROM user "
                         + "where user_login = ? AND user_pwd = ? ";
               pstmt = conn.prepareStatement(sQry);
               pstmt.setString(1, userId);
               pstmt.setString(2, password);
               oRS = pstmt.executeQuery();
               //check for record
               if (oRS.next()) {
                    returnVal = oRS.getString("user_login");
               }else {returnVal = null;}
             }catch (Exception e){            
                  returnVal = null;
          }finally{
               cm.closeResources(oRS, pstmt);
               cm.closeConnection(conn);
          return returnVal;
}// end of servlet class
But i am unable to compile it and i am also getting lots of warnings.
I am getting error at line
1)String uName = validateUser(userId, password);
Unhandled exception type SQLException loginServlet.java TQ3/WEB-INF/src/login line
Following warnings:
2)For loginServlet Declaration
The serializable class DBTest does not declare a static final serialVersionUID field of type long loginServlet.java
3)The static method getConn() from the type connectionManager should be accessed in a static way
4)The static method closeResources(ResultSet, PreparedStatement) from the type connectionManager should be accessed in a static way
5)The static method closeConnection(Connection) from the type connectionManager should be accessed in a static way
Definitely I am doing it wrong but exactly where? I am having very strong doubt the way i am using connections is not the correct way. Pls help me.
regards
Manisha

I am in a search of best way to use connection pooling. Initially was using simple JDBC call, then modified to JNDI, afterwards tried to have common class. Later came accross the idea of Singleton/Static. I wanted to have a common class which will handle all connection related issues and at the same time give good performance.
With due respect to all Java Gurus: i got all from web articles/tutorials/java forum etc. There is a long discussion regarding Singlet vs static in this forum. But finally got confused and could not figure out in my case which method shall i make use of, so tried both.
What I want is somebody pointing out flwas inside my 2 code snippets and guide me about which method shall i adopt in future.
Static way:
package common;
import java.sql.Connection;
import javax.sql.DataSource;
import java.sql.SQLException;
import javax.naming.InitialContext;
import javax.naming.NamingException;
public final class ConnectionManager_Static {
     private static InitialContext ctx = null;
     private static DataSource ds = null;
     public ConnectionManager_Static(){     }
     //as the staic method is updating static var i am synchonizing it
     private static synchronized void getDatasource () throws NamingException, SQLException
          if (ds == null){
               ctx = new InitialContext();
               ds = (DataSource)ctx.lookup("java:comp/env/jdbc/MySql");
     //making getConnection() also static as it is not instance specific     
     public static Connection getConnection () throws NamingException, SQLException, Exception
          Connection conn = null;
          try{     
               if (ds == null) {getDatasource ();}
               if (ds != null) {
                    conn = ds.getConnection();                 
          }catch (Exception e){
               throw new Exception("From ConnectionManager_Static",e);
          return conn;
       }//getConnection
}Singleton:
package common;
import java.sql.*;
import javax.sql.*;
import javax.naming.*;
public final class ConnectionManager_Singleton {
         private static ConnectionManager_Singleton INSTANCE = null;
          private DataSource datasource = null;
          // Private constructor for singleton pattern
         private ConnectionManager_Singleton() throws NamingException{
               Context ctx = new InitialContext();
               datasource = (DataSource)ctx.lookup("java:comp/env/jdbc/MySql");
         //synchronized creator for  multi-threading issues
         //another if check to avoid multiple instantiation
         private synchronized static void createInstance() throws NamingException{
             if (INSTANCE == null) {
                 INSTANCE = new ConnectionManager_Singleton();
         public static ConnectionManager_Singleton getInstance() throws NamingException {
             if (INSTANCE == null) createInstance();
             return INSTANCE;
          public Connection getConnection() throws Exception
               Connection con = null;
               try{
                    con = datasource.getConnection();
               }catch(Exception e){
                    throw new Exception("From connection manager singleton ", e);
               return con;
}Sorry, It's becoming long.
Thanaks in advance,
Manisha

Similar Messages

  • Best way to implement connection pooling with tomcat4.0?

    Hi all!
    I need your help:
    What's the best way to implement connection pooling (Oracle Database) with tomcat 4.0?
    I only found ways to implement it in tomcat 4.1, not in 4.0....
    Thanks!
    Michael

    You can use a Datasource managed by tomcat. Earlier versions of tomcat used Exolab's Tyrex for the implementation of the Datasource API which uses connection pooling. Current version uses commons-dbcp and commons-pool (jakarta projects) I think.
    You've got to declare the Datasource in server.xml and then in web.xml of your web app.

  • The best way to implement connect pool?

    Hi:
    In my web application, I use javabean to access database for JSP, Because a lot of poeple will access my site, I need coonection pool. Then, If I still use JSP,Is it right I should use javabean to access coonection pool? If it is, Am I need another connection pool bean? Or I should switch to Servlet , I might need write a ancestor servlet to access the pool, and other servlet extend the ancestor servlet. Is there other suggestion for me?
    I am a newer to java, any suggestion will be greatly appreciated!
    Thanks a lot!
    xufang

    Hi, Gregor
    Thanks for your reply, I instance my DBConnectionManager in the Bean's constructor as:
    connMgr= connMgr.getInstance();
    and in the bean's getConnection method, I request a connection provided by the pool as:
    Connection dbCon = connMgr.getConnection("idb");
    and and in the bean's execSQL method , I use the dbCon as:
    s = dbCon.createStatement( );
    ResultSet r = s.executeQuery(sql);
    The problem is when JSP go to bean.getConnection,it's all right. But when JSP execute bean.execSQL, There is always wrong because the dbConn I get from the bean's getConnection method if null ! Can you tell me what's the problem arrives?
    Thanks,
    xufang

  • Problem in using connection pool in netbeans

    Hi,
    I am using Net Beans and Sun java application server and Derby as database.
    I have created data connnection and also configure JDBC resources (ie. DataResource and connectionPool).
    Now i want to use this connection pool in my class, I have create one DataConnection class and put this code
    private javax.sql.DataSource getMyDatabase () throws javax.naming.NamingException {
            javax.naming.Context c = new javax.naming.InitialContext();
            return (javax.sql.DataSource) c.lookup("java:comp/env/jdbc/myDatabase");
        }I got this code by right click and selecting Enterprise Resources->Use Data, But while running i got the exception
    javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
    Plz tell me How can we overcome this exception and is there any other way do use connection pool.
    Thanks.

    Thanks bamkin-ov-lesta,
    DbConnectionBroker is good for servlet or other java application. If i use this class, it is like i am writing code for connection pool. I am using NetBeans and sun java application server which provide its default connection pool configuration and i want to use that only.
    And I am not getting which class name to be set in environment variable under what name in the following exception.
    javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
    Help me plz.

  • Best way to use JDBC in an application

    I'm developing a Java application using Swing and DB2 with JDBC. The way I'm developing it is: for every query, regardless its type, that a need to process in the database, I create a connection, execute the query, process the results and finally disconnect from the database. This works fine, but this application makes a lot of database processing, so makes a lot of connections-disconnections. I read an article that states that is not a good use of JDBC to leave connections useless, for that reason I always close the connections.
    So my question is: is it ok to develop an application with a lot of db processing this way, or is it better to make a connection, leave it open while the application is open, and use this connection every time a database request is needed, and only close it when the application terminates?

    eflores767003 wrote:
    Jschell, Thanks again.
    I looked for the db2 document I was talking about, the one that refers about connection pooling. This the link: ftp://ftp.software.ibm.com/ps/products/db2/info/vr8/pdf/letter/db2aje80.pdf
    In Page 27 is written that the IBM JDBC Universal Driver (Type 4) restricts Connection Pooling.
    I am rather certain that that section is referring the ibm driver - in that the ibm driver does not support pooling.
    I have not read the information you gave me. I'm just giving you the information I had before I got in touch with you.
    And answering your question, (You do in fact have a server written in java right?):
    My application connects to a DB2 DBMS server through an object, instance of class I made, kind of DAO object, that makes all the database processing. In the DBMS I got Java stored procedures. I'm not sure if the java server you are asking about is the DBMS or the java class I wrote. I do not use a web server so my application is a two tier one.
    So each client app is maintaining the connections. A pool could still be used, it would certainly have less impact. You must configure it carefully to insure that idle connections do not remain for very long. 5 minutes would be good. You don't want someone going on vacation and leaving their app up that keeps 20 connections open for 2 weeks.
    But I still keep the doubt about the way I'm using the db processing (make connections, process the queries and disconnect ). Because you said that " It isn't necessary (volume/usage doesn't require it.) Doesn't mean that you can't do it."
    Nothing you said so far says that you need to use pooling.
    Everything that you said requires that you do not maintain connections at the usage layer - so always close them. Do not attempt to hold one open if you are not using a pool.
    If you do use a pool then you would configure it to keep a very few (perhaps even just 1) open for a short time if it was not being used.
    At this point the only gain for using a pool would be the experience that it gained you.
    So, do you suggest that my application should keep an open connection, instead of the current approach? Remember that I'm not using connection pooling.
    No.
    What would be the consequences of keeping my approach?
    At best unused connections. At worst potentially running out due to long running application.
    Why is not good to leave a useless connection in application? Because it uses resources in the database, not just the application.
    Realistically in your situation it might never become a problem. But if you close them then there is no possibility that it will become a problem.

  • Best way to use an external drive

    Hello all,
    I have several photos.
    I also have three computers that I regularly use: my Windows PC, my Macbook Pro, and a very new iMac.
    Rather than place all my photos on each computer... I thought I could place them on a Western Digital Passport portable ext. drive. Then somehow use the drive from computer to computer to edit/play with my photos.
    How do I best use iPhoto 08 to do that? I'm not sure... do the photos have to be on the computer in order to make albums, libraries, folders, etc? Or are those things more of thumbnails that POINT to certain files?
    Please help a newbie understand the best way to use his external drive.
    Thanks for any and all help!

    Hello, and welcome, Theodore!
    I must first say that I don't yet have iPhoto 8.
    I do, however, have a lot of experience with external drives (I have two). I have a huge amount of music in iTunes, so I keep a copy of it on each external drive. Then, when I need to access my music , I turn on either external drive, up comes the External Drive symbol on my display, then I go over to my dock, and select iTunes. I must remember to first open up the External Drive BEFORE I open iTunes (or iPhoto). I then add or subtract music (or photos), edit, and work on my collection. When I'm finished, I just close the application, then select the Hard Drive symbol, and choose File/ Exit Hard Drive. Reach over and turn off my Hard Drive, and it's all good. I just always remember to open the Hard Drive FIRST, before opening the application.
    The same would work for iPhoto. If you place iPhoto onto your external drive, you could probably use any of your computers to connect to it. I would suggest you think about backing up your external drive's contents with either another external drive (which was my choice), or other alternate storage methods.
    I only have one PowerBook, not multiple computers, but, other than that, the situation's the same. You want to keep your iPhoto collection off your computers, and onto one external drive. I hope this information can be of some help to you.
    All best wishes... Cea

  • Using Connection Pooling in a WLS 5.1.x - Cluster

    Hi,
              We have problems using connection pooling in a WLS 5.1.x - Cluster. Is it
              possible to use CP in such a cluster at all ? The problem is, connections
              will be opened and never been closed. How can I configure a cluster for CP?
              I have a WLS-Cluster with 2 instances and my webApp uses connection pooling.
              By the way I get a connection on Instance 1, Instance 2 gets a connection
              also, but never releases it.
              In my opinion, the reference to the connection in the partner-instance will
              be lost.
              How do I have to configure my cluster to work well with that stuff ?
              Thank a lot,
              Markus.
              

    Clustering with connection pools works fine in WLS 5.1. If connections are
              not being release, you have bugs in your code.
              When a connection is retrieved from a pool on one instance, a corresponding
              connection is NOT retrieved on another instance.
              Mike
              "M. Hammer" <[email protected]> wrote in message
              news:[email protected]..
              > Hi,
              >
              > We have problems using connection pooling in a WLS 5.1.x - Cluster. Is it
              > possible to use CP in such a cluster at all ? The problem is, connections
              > will be opened and never been closed. How can I configure a cluster for
              CP?
              >
              > I have a WLS-Cluster with 2 instances and my webApp uses connection
              pooling.
              > By the way I get a connection on Instance 1, Instance 2 gets a connection
              > also, but never releases it.
              > In my opinion, the reference to the connection in the partner-instance
              will
              > be lost.
              > How do I have to configure my cluster to work well with that stuff ?
              >
              > Thank a lot,
              >
              > Markus.
              >
              >
              >
              

  • How to access database from applet using connection pooling.

    Hi,
    I am using tomcat 4.1, JRE 1.4.2_10, MySQL 5.0, and IE 6.0. I can access the database using connection pooling from JSP without problems. But, if I try to acess from the applet, I get the following exception (related to JNDI.):
    javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
    at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
    at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
    at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)
    at javax.naming.InitialContext.lookup(Unknown Source)
    I know what this acception means, but I don't know how to fix it. I set up connection pooling in my Tomcat 4.1 that talks to MySQL 5.0. As I said, when I access from jsp, JNDI works. But, applet complains. Please help. In my applet, the following code accesses the database:
    ArrayList toolTipData =
          access.getToolTipData (projectName,interfac);This is the snipet of my Access class:
    public ArrayList getToolTipData (String projectName, String interfac) {
        System.out.println("In getToolTipData");
        ArrayList toolTipData = new ArrayList();
       try{
        Context ctx = new InitialContext();
        if(ctx == null )
            throw new Exception("No Context");
        DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/interfacesDB");
        if (ds != null) {
          Connection conn = ds.getConnection();
          if(conn != null)  {
              Statement s = conn.createStatement();
              //For some reason paramtized queries don't work, so I am forced
              //to this in slighly less eficient way.
              ResultSet rst = s.executeQuery("select * from interfaces");
              while (rst.next()) {
                 if (rst.getString("Project_Name").equals(projectName) &&
                     rst.getString("Interface").equals(interfac)) {
                   System.out.println("getToolTipData: ITG #" + rst.getString("ITG"));
                   toolTipData.add("ITG #: " + rst.getString("ITG"));
                   toolTipData.add("SPNE Prime Name: " +
                                   rst.getString("SPNE_Prime_Name"));
                   toolTipData.add("PD Prime Name: " +
                                   rst.getString("PD_Prime_Name"));
                   toolTipData.add("IT Prime Name: " +
                                   rst.getString("IT_Prime_Name"));
                   toolTipData.add("MLC Priority: " +
                                   rst.getString("MLC_Priority"));
                   toolTipData.add("Gary's Prime: " + rst.getString("Garys_Prime"));
                   toolTipData.add("QA Prime: " + rst.getString("QA_Prime"));
                   toolTipData.add("Brief Description: " +
                                   rst.getString("Brief_Description"));
                   toolTipData.add("Project_Status: " +
                                   rst.getString("Project_Status"));
              conn.close();
      }catch(Exception e) {
        e.printStackTrace();
      return toolTipData;
    ....

    The jsp runs on the server, whereas the applet runs on the client so
    you must package with your applet any jndi implementation specific classes
    and
    Properties props = new Properties();
    props.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory" );
    props.setProperty("java.naming.provider.url", "url:1099");
    Context ctx = new InitialContext(props);
    Object ref = ctx.lookup("...");

  • Problems using connection pooling

    I'm having problems configuring connection pooling in oc4j. Have specified my datasource/connection pool in my data-sources.xml. I always get the following error when I try to access it with an instance of OracleConnectionPoolDataSource within my apps. The app server dosen't seem to create the connections when started 'cos its not displayed within Oracle dba studio. Can anyone tell what I need to do pls.
    regards!
    dyzke
    //-- error displayed
    Exception in thread "main" java.sql.SQLException: Io exception: The Network Adap
    ter could not establish the connection
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:210)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:323)
    at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:260)
    at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.ja
    va:365)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:260)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java
    :111)
    // -- extract
    <data-source
              class="com.evermind.sql.DriverManagerDataSource"
    name="MYDS"
              location="jdbc/XXX"      
    xa-location="jdbc/xa/OracleXADS"
              ejb-location="jdbc/OracleDS"
    pooled-location="xxx/xxxx"
              max-connections="10"
              min-connections="3"                    
              connection-driver="oracle.jdbc.driver.OracleDriver"
              username="admin"
              password="admin"
              url="jdbc:oracle:thin:@localhost:xxx"
              inactivity-timeout="30"
         />

    see my answer in the other newsgroup.
    please don't cross post.
    "M. Hammer" <[email protected]> wrote in message
    news:[email protected]..
    Hi,
    We have problems using connection pooling in a WLS 5.1.x - Cluster. Is it
    possible to use CP in such a cluster at all ? The problem is, connections
    will be opened and never been closed. How can I configure a cluster forCP?
    >
    I have a WLS-Cluster with 2 instances and my webApp uses connectionpooling.
    By the way I get a connection on Instance 1, Instance 2 gets a connection
    also, but never releases it.
    In my opinion, the reference to the connection in the partner-instancewill
    be lost.
    How do I have to configure my cluster to work well with that stuff ?
    Thank a lot,
    Markus.

  • Whether or not using connection pooling?

    Hi,
    This is our configuration of data-sources. I want to make sure that it uses connection pooling. How can i check it?
    All the jsp forms works fine but I do not know whether it uses connection pooling. Please help.
    <data-source
    class="com.evermind.sql.DriverManagerDataSource"
    name="OracleDS"
    location="jdbc/OracleCoreDS"
    xa-location="jdbc/xa/OracleXADS"
    ejb-location="jdbc/OracleDS"
    connection-driver="oracle.jdbc.driver.OracleDriver"
    pooled-location="jdbc/pooled"
    username="xxxx"
    password="xxxx"
    max-connections="50"
    min-connections="15"
    connection-retry-interval="1"
    url="jdbc:oracle:thin:@xxxx.xxx.org:1521:xxxx"
    inactivity-timeout="30"
    wait-timeout="30"
    />
    </data-sources>

    Kavi -- the datasource is one part of the equation. You look to have correctly configured one to enable connections to be pooled. You are using an emulated datasource.
    The other aspect to this is which "location-value" you lookup and use from your code.
    If you want to have a pooled connection datasource, given this definition you have, then you need to lookup the value of the "ejb-location" from within your code.
    If you do this directly, then it'd look something like:
    try
    InitialContext ctx = new InitialContext();
    DataSource poolDS = (DataSource)ctx.lookup("jdbc/OracleDS");
    Connection c = poolDS.getConnection();
    catch(NamingException ne}
    With the min-pool setting and the emulated datasources, the min-connections are not established at startup time. The connections grow, and once they meet the min setting, they are never allowed to drop below that value.
    One way to check for the connections being used is to query the Oracle database data dictionary
    logon as system (or a dba priv account) and query the
    v$session table with something like
    SQL> select username,proc from v$session
    USERNAME PROGRAM
    SYS ORACLE.EXE
    SYS ORACLE.EXE
    SYS ORACLE.EXE
    SYS ORACLE.EXE
    SYS ORACLE.EXE
    SYS ORACLE.EXE
    SYSTEM sqlplus.exe
    FAQAPP JDBC Thin Client
    The J2EE Services Guide from the OTN documentation area describes the datasources and their functions in more detail.
    cheers
    -steve-

  • What is the best way to use wi-fi to transfer pdf files from an ipad to a mac mini, not using an internet, just wi-fi.

    What is the best way to use wi-fi to transfer pdf files from an ipad to a mac mini, not using an internet, just wi-fi?

    If the Mac use Lion (10.7) you can use Airdrop for that.
    With Mac's not using Lion you may set up a computer to computer (ad hoc) connection.
    How to --> http://docs.info.apple.com/article.html?path=Mac/10.6/en/8339.html
    Lupunus

  • Calling a RFC using connection pool

    Can I use connection pool to call a RFC from my R3? I'm using SAP Enterprise Connector but I don't want to pass user/password hardcoded.
    Thanks in advance.

    Hi Kiran,
    Yes I used SAP JRA and it works.
    You need JRA deployed and configured on WAS, your basis guy can do it for you. The next step is download this PDF  <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/ad09cd07-0a01-0010-93a9-933e247d3ba4">Accessing BAPIs Using the SAP Java Resource Adapter</a>.
    Follow this document, it's very easy to do so.

  • How do i use Connection pool in JSP pages

    Hey everyone,
    I am using a connection pool in my web application. I am using DbConnectionBroker from Javaexchange.com. It has a class that creates a connection pool available for the servlets. I am trying to figure out that how to use connection pool within the JSP pages if I want to connect to the database. In the servlets i am using DBConnectionBroker pool = (DbConnectionBroker) getServletContext().getAttribute("dbPool") to get database connection. How Can i use this in JSP page to get a db connection.
    Thanks

    If the reference to the connection pool is already stored as an ServletContex attribute, try:
    <jsp:useBean id="dbPool" scope="application" class="com.javaexchange.dbConnectionBroker" />
    <%
    Connection con = dbPool.getConnection();
    %>

  • HT3819 I have 2 Ipod touch's, one a 64gb and one an 8gb.  Whats the best way to use them both on the same itunes account?

    I have 2 Ipod touch's, one a 64gb and one an 8gb.  Whats the best way to use them both on the same itunes account?

    Click here for options.
    (64410)

  • What's is the best way to use iPhoto? I need to understand.

    What's is the best way to use iPhoto? I need to understand.
    I guess the iPhoto is only for people with 5,000 of personal photos.
    Or even 200,000, but they can't use this app everyday.
    I'm not talk about working as a photographer. They use Aperture.
    They may use iPhoto like a family album that you take a look sometimes.
    And don't care about putting photos from the camera or from internet everyday.
    I have tons of music and I love iTunes 8, works great. So I tried but I can't stand iPhoto anymore.
    I have over 173,000 photos. My goal is organize, have total control, crop in Preview and delete them fast as I can.
    The iPhoto is too slow. And is not only about performance, more RAM... but the whole concept.
    Finder is much better/richer/flexible to organize than iPhoto.
    I'm not talking about the photographer workflow.
    And I'm not talking about editing and all these great photo features, the search, and all the iLife environment. They are amazing.
    When I'm iPhoto, I feel like a prisioner.
    I can't open an album/folder/event alone just to take a look, without do lanch the iPhoto app with the all thousand photos together. And it's slow.
    I can't use Quick Look there.
    So, I'll use Finder for manage/crop/etc. But what's the best way to use iPhoto in my case? Put the best/key ones there to use in iLife/MobileMe? To do a more serious editing? I like the features: keywords/ratings/hidden photos/events... It would be cool this features in Finder.
    For example:
    iMovie: Manage movies? NO. It's editng only.
    iTunes: Manage music/small video/podcast...? OK. Editing the song? OK for tags/convert/artwork/equalizer... For music there's a GarageBand of course.
    iPhoto: Manage photos? Yes and No.
    I think Finder would kill iPhoto incoporating all the editing features in Preview and the rich manage in Finder.
    Jobs said that no one care about iDVD anymore. They care about the web.
    Using iMovie to export to MobileMe.
    Maybe iPhoto become less important in a near future. With a better Finder+Preview Right?
    Sorry for this long text with a short question.
    Thanks.

    Your post demonstrates exactly why I keep saying that iPhoto is not the application for you.
    It would be better an iPhoto organizing photos by words like when iTunes browse his music.
    Why on earth would anyone want to organise photos by words? A list mode is entirely pointless in a Photo application. That's like having an old photo album organised with the photos facing inwards so you can read the back of the picture.
    Again, this is a characteristic of a File browser. You don't want a Photo organiser, you want a file organiser.
    And, in iPhoto, you can search by tags, effortlessly in either the search box or by using a Smart Album.
    iPhoto always loads all that events and all the thumbs library to scroll, and I think it's overkill.
    So, how is iPhoto to know which ones you want to work with today? Open a library, get the Library.
    Would be better a Cover Flow option to browsing in Events.
    You've obviously never tried scrubbing along the Event icon.
    Imagine iTunes using Cover Flow mode all the time. It won't be too useful.
    Many, many people do, including myself on a library of 20k tracks totalling more that 100 gigs, and find it very useful. Same with the Finder.
    And if when iTunes Store starts to sell photos?
    Why on earth would the iTunes store start to sell photos?
    My photos are not junk,
    I didn't say there were. Read my post again.
    When I said Finder to crop photos I mean Preview. But I feel in Finder. Because what's in Preview? A photo opened with a Preview's menubar and some cocoa APIs like adjustments. Not?
    Oh, so you don't count Preview as an application. Fine. It is an application but you don't feel it. As you wish.
    My point to you is very simple: Because of the way you want to organise your pics - using lists views and so on - iPhoto is not the application for you. Don't use it. But you keep writing things about the application that are untrue, and I'm aware that other folks search these forums and I don't want them to have inaccurate information about iPhoto.
    Regards
    TD

Maybe you are looking for