Datasource question

Hi. I have a number of jsp pages which contain code as follows:
<sql:setDataSource dataSource="jdbc/dbtest"/> <sql:query var="items" sql="SELECT * FROM homepagesubscriptions" > </sql:query>
Now my question is will performance of the app be affected due to referring to the datasource multiple times in these various jsp's. I am just trying to get my head around what a dataource is. I have configured the datasource in my tomcat context file. Am I right in thinking that when the web server starts up, the datasource is initialised once and everytime I reference the datasource from my app it is referring to this same datasource - in which case it is not negatively affecting performance.
thanks

i am using connection pooling. Here is what I have in my tomcat context file:
<Context reloadable="true" docBase="C:\struts2\website" >
     <Resource name="jdbc/dbtest"
          auth="Container"
          type="javax.sql.DataSource"
          factory="org.apache.commons.dbcp.BasicDataSourceFactory"
          driverClassName="com.mysql.jdbc.Driver"
          url="jdbc:mysql://localhost/website"
          username="root"
          password="xxxx"
          maxActive="20"
          maxIdle="10"
          maxWait="10000"
          removeAbandoned="true" />
     <Realm className="org.apache.catalina.realm.DataSourceRealm" debug="99"
          dataSourceName="jdbc/dbtest"
          digest="MD5"
                localDataSource="true"
          userTable="users" userNameCol="user_name" userCredCol="user_pass"
                userRoleTable="user_roles" roleNameCol="role_name"/>
</Context>thanks darted

Similar Messages

  • KODO DataSource questions

    Our setup:
    Tomcat 5.5, KODO 3.4.1, single transaction per request on the application (application is sessionless).
    Observations:
    1. When we specify javax.jdo.option.ConnectionURL, javax.jdo.option.ConnectionUserName, javax.jdo.option.ConnectionPassword in the properties file, it uses the KODO DataSource specifically com.solarmetric.jdbc.PoolingDataSource.
    2. If we want to use JNDI, we specify javax.jdo.option.ConnectionFactoryName=java:comp/env/jdbc/MyDB in the properties file and then in our tomcat server.xml context we add something like the following:
       <Resource
       name="jdbc/MyDB"
       auth="Container"
       type="javax.sql.DataSource"
       driverClassName="oracle.jdbc.driver.OracleDriver"
       url="jdbc:oracle:thin:@_host_:_port_:_SID_"
       username="_username_"
       password="_password_"
       maxActive="10"
       maxIdle="5"
       maxWait="-1"/> 3. When specifying with JNDI in tomcat, it appears to use the tomcat DataSource (org.apache.tomcat.dbcp.dbcp.BasicDataSource).
    4. Using the tomcat BasicDataSource means that we get no prepared statement caching - this is a documented issue with using third party DataSources.
    5. Using the tomcat BasicDataSource also seems to do a database rollback after every persistence manager 'close', which in our setup equates to each request.
    Questions:
    1. How do we force KODO to use it's own DataSource when using JNDI in tomcat?
    2. How would we force KODO to use a different DataSource in the properties file (like the tomcat BasicDataSource)?
    3. Is there any way to stop the database rollback after each persistenceManager close when using the tomcat BasicDataSource?
    4. Is it recommended to use the KODO DataSource? Are there any reasons to not use it?
    5. What are the main differences between the KODO DataSource and the tomcat BasicDataSource?
    Many thanks in advance.
    Nick

    Can anyone shed some light on how we get statement caching working whilst using JNDI to specify the db connection details? Is this possible???
    Any info/help would be very much appreciated as statement caching is something we would now like to enable.
    Many thanks,
    Nick

  • Generic DataSource Question

    Hi Friends,
    We have generic extractor based on the function module.
    It submits the report program and returns some value.
    This function module has parameter called S_S_IF-Maxsize = I-Maxsize.
    My counter is based on this,
    Counter GE S_S_IF-Maxsize.
    Now my question is what value of S_S_IF-Maxsize is determined by system and how?
    When I am checking in RSA3 it is based on the selection screen parameters on RSA3(By default:100).
    When I test in SE37-function module it  takes 000000 by default, I may change here to test and debug. But I wanted to know that when called by BW how it takes value of S_S_IF-Maxsize.
    If somebody knows the procedure on how to debug extractor when called by BW, please let me know.
    Please suggest.
    Thanks,
    John.

    Hi,
    A simple way to check how BW calls the extractor and what values are passed is to use RSA3 itself in the source system.
    Execute an infopackage in BW and note down the request number or you can use the request number of an existing one.
    Go to RSA3 in the source system, enter your datasource details there.  There will be a button next to the execute button at the top called "Import from BW".  Click that and enter the request number and the BW system logical name and hit enter.
    The parameters from the request will be imported.  You can view them and then debug using this data.
    Cheers
    Neeraj

  • Datasource question on ecc selection fields.

    I have accidentally clicked on maintaince for 2lis_02_itm datasource in lbwe and it went to inactive mode.
    1)How do I make it active without altering the fields in the selected ds. Do i have to replicate it back if I make it active again ?
    2) If I add the selection criteria in the selection of fields so that those are available in IP selection, do i have to replicate the ds on BI. (in rsa6)
    3) I need to add one more field from right to left and now its available in the extracture structure. To get that field to ecc, should i just replicate the ds. How about creating the infobject for that field and replicate or ?
    4) there are lot of other flow to the pur flow, so will all those get deactivated when the structure of the ds changes. do i need to activate all the trans dtp etc.

    Hi Daniel,
    1)How do I make it active without altering the fields in the selected ds. Do i have to replicate it back if I make it active again ?
    Just click on activate the data source with out generating the data source ( if you had not enhanced any of the fields).
    2) If I add the selection criteria in the selection of fields so that those are available in IP selection, do i have to replicate the ds on BI. (in rsa6)
    If you had enables the option "SELECTION" for particular file, first you need to activate in RSA6 and replicate the data source in BW side so that the changes are effected in BW side and the field will be made available for loading.
    3) I need to add one more field from right to left and now its available in the extracture structure. To get that field to ecc, should i just replicate the ds. How about creating the infobject for that field and replicate or ?
    If the field is available in the Right hand side then move that field to Left hand side it will be available in the extract structure, click on generate data source and activate in LBWE.
    Replication of data source we need to do it in BW side,inorder to copy the same extract struture of the Source.
    Yes you need to assign this to an info object(you can search for BI content object,as most of the objects are available in the bi content if not create your own io).
    4) there are lot of other flow to the pur flow, so will all those get deactivated when the structure of the ds changes. do i need to activate all the trans dtp etc.
    If you are changing a particular data source extract structure then the changes are reflected with respect to that single data source only.
    If the option HIDE is selected :
    Hide Field: Activating this indicator effectively removes the field from the data-transfer process. The field will no longer be available in the transfer structure and therefore will not be pulled into BW. This field should not be active unless you know that the field contains data not relevant to the DataSource.

  • Extract DataSource Question

    Hi All!
    I would LOVE to be able to have an export datasource from a Master data InfoObject (0MAT_PLANT) feed MULTIPLE infoSources. Is that possible? Is there any top secret, back-door way to accomplish this, or am I restricted to using the Hub-and-spoke method to create multiple flatfiles from this to hook to infosources?
    Thanks!!!
    Mark Ulrich

    hi,
    you can have master data infoobject as datasource,
    rsa1->infoprovider->right click certain infoarea and 'insert characteristic as infoprovider', type in 0mat_plant, then right click that 0mat_plant there and 'generate export datasource', right click source system bw myself and 'replicate datasource', the datasource will be 8mat_plantT and 8mat_plantM something. assign the datasource to infosource and let this infosource update your data targets.
    hope this helps.

  • Datasource questions

    All,
    I'm confused by the relationship between XA dataources and Enlisted
    datasources. If I understand the Kodo manual correctly, all XA datasources
    MUST be Enlisted. However, I infer that it is possible to enlist a non-XA
    datasource. That is, it is possible to set up a datasource that does NOT
    use an XA driver, and then set datasourcemode to 'enlisted'. Is this
    correct?
    In the same vein, I'm puzzled about when a second connection is needed.
    The Kodo manual clearly states that:
    "Kodo needs to have access to a data source that will not be enlisted
    in an XA transaction for things like obtaining database sequence numbers
    for datastore identity, which should not be part of Kodo's transaction."
    The manual then describes the need to set up a second, non-XA,
    datasource if you have an enlisted XA datasource. But, if my enlisted
    datasource is not an XA datasource, would I need the second datasource?
    Finally, what is the effect of setting transactionmode to 'managed', but
    leaving datasourcemode as 'local', rather than 'enlisted'?
    Thanks,
    Mike

    Unfortunately, the answer varies from appserver to appserver and
    configuration to configuration.
    Basically, when we refer to XA datasources, it covers all datasources
    that are transactional based on the global J2EE tranasction. Most
    application servers treat these regardless of driver and DB as an XA
    resource.
    While this could be clarified in the documentation, you should treat all
    datasources which are enlisted in global transaction as an indication to
    use enlisted as the DataSourceMode and configure a second
    ConnectionFactory DataSource for things that should not be held by the
    global transaction such as sequence generation.
    Probably worth noting is WebSphere which all datasources are
    transactional by default.
    Michael England wrote:
    All,
    I'm confused by the relationship between XA dataources and Enlisted
    datasources. If I understand the Kodo manual correctly, all XA datasources
    MUST be Enlisted. However, I infer that it is possible to enlist a non-XA
    datasource. That is, it is possible to set up a datasource that does NOT
    use an XA driver, and then set datasourcemode to 'enlisted'. Is this
    correct?
    In the same vein, I'm puzzled about when a second connection is needed.
    The Kodo manual clearly states that:
    "Kodo needs to have access to a data source that will not be enlisted
    in an XA transaction for things like obtaining database sequence numbers
    for datastore identity, which should not be part of Kodo's transaction."
    The manual then describes the need to set up a second, non-XA,
    datasource if you have an enlisted XA datasource. But, if my enlisted
    datasource is not an XA datasource, would I need the second datasource?
    Finally, what is the effect of setting transactionmode to 'managed', but
    leaving datasourcemode as 'local', rather than 'enlisted'?
    Thanks,
    Mike
    Steve Kim
    [email protected]
    SolarMetric Inc.
    http://www.solarmetric.com

  • Export Datasource Question

    Task : To load the actuals into a planning cube.
    After generating an export datasource on  a cube infosource 8CUBE is created.
    When I create an infopackage ..in the Datatargets tab how do I find the planning cube..?
    What am I missing here ..?

    Hi,
    Assuming you have created update rules from the 8CUBE to the planning cube, right click > Switch Transactional Cube > Choose Can be Loaded.
    This can also be done using FM (so that you can switch between the 2 states in a process chain and automate the process)
    Hope this helps...

  • Push/DataSource question about .cda files

    Hi,
    I'm trying to programm a program and with it it should be possible to rip .cda files to .wav files.
    Now I found a way how to do this, but I'm not sure, if my idea works well.
    My idea:
    In Windows it is possible to play .cda files with JMF.
    I read, that a cda file is only a pointer to a location on the CD and at this location there is stored a file which is quiet the same as a .wav file.
    But what is, when I create a PushDataSource (or something else, I don't know) and get the source-stream, read the bytes and save this to a .wav file.
    Is this a way to rip .cda files?
    Thanks for answers, thomas

    Are you talking about this?
    This is optional. You don't need to use this at all. It's just to verify that the account details you have entered are valid (ie test connection).
    Note that your client push installation account has to be local administrator on all devices on which you want to install a client.
    Gerry Hampson | Blog:
    www.gerryhampsoncm.blogspot.ie | LinkedIn:
    Gerry Hampson | Twitter:
    @gerryhampson

  • IBM WSAD 4.0.3 - getting the DataSource object

    Hi guys , i had posted a DataSource question before...but i was able to figure that out. My new problem is that i cant get the DataSource object in my java program and the following error is thrown.
    java.lang.NoClassDefFoundError: com/ibm/ejs/ras/TraceElement
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Class.java:212)
         at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:46)
         at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:656)
         at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
         at javax.naming.InitialContext.init(InitialContext.java:223)
         at javax.naming.InitialContext.<init>(InitialContext.java:199)
         at DataSourceCheck.main(DataSourceCheck.java:27)
    Exception in thread "main"
    Here is my Java program :
    import java.sql.*;
    import javax.naming.*;
    import java.util.*;
    class DataSourceCheck
         public static void main(String[] args)
              javax.sql.DataSource myDataSource= null;
              try
                   String initialContextFactory = "com.ibm.websphere.naming.WsnInitialContextFactory";
                   String providerURL = "iiop://localhost:8081";
                   java.util.Properties props = new java.util.Properties();
                   props.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactory);
                   props.put(Context.PROVIDER_URL, providerURL);
                   Context myContext = new InitialContext(props);
                   Connection myConnection = myDataSource.getConnection();     
              catch (Exception e)
                   e.printStackTrace();
                   System.out.println();
    I start a Server instance from IBM WSAD and it runs on 8081.
    Please suggest what to do .

    sorry..i forgot to delete that line...its a typing eror.
    Here is the code again....
    I fail to get the context.
    import java.sql.*;
    import javax.naming.*;
    import java.util.*;
    class DataSourceCheck
         public static void main(String[] args)
              javax.sql.DataSource myDataSource= null;
              try
                   String initialContextFactory = "com.ibm.websphere.naming.WsnInitialContextFactory";
                   String providerURL = "iiop://localhost:900";
                   java.util.Properties props = new java.util.Properties();
                   props.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactory);
                   props.put(Context.PROVIDER_URL, providerURL);
                   Context myContext = new InitialContext(props);
                   //myDataSource = (javax.sql.DataSource)myContext.lookup("jdbc/oracle/OracleDataSource");
                   //Connection myConnection = myDataSource.getConnection();     
              catch (Exception e)
                   e.printStackTrace();
                   System.out.println();

  • IBM WSAD 4.0.3 - creating a DataSource

    I am using Oracle9i. Please suggest how to create a DataSource.
    Please tell all the steps.

    Hi guys , i had posted a DataSource question before...but i was able to figure that out. My new problem is that i cant get the DataSource object in my java program and the following error is thrown.
    java.lang.NoClassDefFoundError: com/ibm/ejs/ras/TraceElement
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Class.java:212)
         at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:46)
         at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:656)
         at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
         at javax.naming.InitialContext.init(InitialContext.java:223)
         at javax.naming.InitialContext.<init>(InitialContext.java:199)
         at DataSourceCheck.main(DataSourceCheck.java:27)
    Exception in thread "main"
    Here is my Java program :
    import java.sql.*;
    import javax.naming.*;
    import java.util.*;
    class DataSourceCheck
         public static void main(String[] args)
              javax.sql.DataSource myDataSource= null;
              try
                   String initialContextFactory = "com.ibm.websphere.naming.WsnInitialContextFactory";
                   String providerURL = "iiop://localhost:8081";
                   java.util.Properties props = new java.util.Properties();
                   props.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactory);
                   props.put(Context.PROVIDER_URL, providerURL);
                   Context myContext = new InitialContext(props);
                   Connection myConnection = myDataSource.getConnection();     
              catch (Exception e)
                   e.printStackTrace();
                   System.out.println();
    I start a Server instance from IBM WSAD and it runs on 8081.
    Please suggest what to do .

  • CF8 Installed - now what?

    I just installed the Cold Fusion 8 developer edition - which
    I assumed was all I needed to get rolling with development, but it
    appears (at least to me) to only be the server side of things. Is
    there something more I have to download and install, or was the
    installation of dev edition somehow wonky and I'm missing
    something?

    Rolaaus,
    I can see Katsuey's point. Your response to him could have
    been fairer.
    His IIS answer is a valid answer to your original question.
    You had installed Coldfusion and wished "to get rolling with
    development", but admitted you had only taken care of the server
    side. Katsuey's advice here, that you install or configure a web
    server, is quite good actually. In fact, his advice that you test
    your installation by opening the Administrator page is as
    fundamental to Coldfusion as an output of "Hello World!" is to
    Java. The fact that you were able to configure a datasource in the
    Coldfusion Administrator means that you did indeed do as Katsuey
    had suggested.
    There is something else I don't quite understand. Why would
    you want to download and install two flavours of Coldfusion, one of
    half GB and one of 200 MB? Coldfusion is an application server.
    Downloading and installing just the Coldfusion 8 Developer Edition,
    as you apparently have done, is sufficient.
    You shouldn't give up so soon. Especially not when you seem
    to be doing all right. From what you've described, you got a clean
    installation in one. Some of us are bald from all the hair-pulling
    that went on during failed installation attempts.
    I think you're almost there. As you already intend to do,
    start a new thread on the datasource question. Mention the settings
    you used in the administrator and how you wish to test the
    connection to a database.
    Good luck.

  • Datasources connection questions

    hi all
    my question is about How the connections stored in a Jndi server datasource pool are managed.
    For example, I'm developing a J2EE application with Ejbs and Datasources, etc. I saw that when I want to retrieve a connection from datasource to work on it I need do something like this:
    For example to retrieve a datasource connection:
    Hashtable jndiProps = new Hashtable();
    jndiProps.put(Context.INITIAL_CONTEXT_FACTORY,...);
    jndiProps.put(Context.PROVIDER_URL, ...);
    Context context = new InitialContext(jndiProps);
    DataSource ds = (DataSource) context.lookup("jdbc/MyDatasource");
    Connection con = ds.getConnection();
    ...I know in this case that the server manages a datasource connection pool, etc
    My question is when a get a connection from the Datasource pool of my app server. do I need to release the connection with some special method when I finish with it (in order to return it to the pool) or it doesn't matter ?
    thanks in advance

    If I have three prepared statements right in a row with nothing in between should I close the connection after each one and then get it again?
    Seems like I would be just as well off to just get the conn once do the 3 things then close it.
    and in spots I might actually be doing something as i step through the first result set so can i use conn.preparedStatement() in the loop many times without getting the connection and closing each time through the loop?
    i of course close all PS and RS and use diff PS2 and RS2 in the loop so i 'm just talking about keeping the conn open while (RS.next()) and use it multiple times to conn.preparedStatement() inside the loop?
    or should i use 2 connections lol and open conn1 and then in loop use conn2 and close it each time around the loop and then close conn1 when i exit the loop?

  • Basic questions about PL/SQL web services and datasource names

    Hi there,
    I successfully generated a web service for a PL/SQL packaged procedure in JDeveloper 11.1.1.3.0).
    In the web service base class the following code was generated:
    __dataSource = (javax.sql.DataSource) __initCtx.lookup("java:comp/env/jdbc/dbconnectionDS");However in the weblogic server the datasource name is jdbc/somethingelse so the deployment fails at first.
    What is the recommended procedure to solve this issue? The obvious solution is to manually edit the source -- that is what I did and it worked fine. However if I re-generate the web service I will lose my change. Is there a better way to do this?
    Another question -- in the generated web.xml file, there is a resource-ref for the datasource. I was hoping that changing the datasource name there would help but it didn't work. What is it used for in this context?
    Thanks
    Luis

    Hi Vishal,
    I did as you suggested but it didn't work... see below more details.
    Thanks
    Luis
    1 - I re-generated the web service from the PL/SQL package. The constructor in CFBTestWSBase class looks likes this:
    public CFBTestWSBase() throws SQLException
      {  try {
    javax.naming.InitialContext __initCtx = new javax.naming.InitialContext();
    __dataSource = (javax.sql.DataSource) __initCtx.lookup("java:comp/env/jdbc/custfeedbackDS");
    } catch (Exception __jndie) {
    throw new java.sql.SQLException("Error looking up <java:comp/env/jdbc/custfeedbackDS>: " + __jndie.getMessage());
    }2 - I added the following section to weblogic.xml:
      <resource-description>
        <res-ref-name>comp/env/jdbc/custfeedbackDS</res-ref-name>
        <jndi-name>jdbc/DataSource</jndi-name>
      </resource-description>3 - I got the following error when during deployment to weblogic server:
    [HTTP:101216]Servlet: "CFBTestWSPort" failed to preload on startup in Web application: "CustFeedbackTestWS.war".
    java.sql.SQLException: Error looking up <java:comp/env/jdbc/custfeedbackDS>: While trying to look up comp/env/jdbc/custfeedbackDS in /app/webapp/CustFeedbackTestWS.war/346617503.
    at cfbtestws.CFBTestWSBase.<init>(CFBTestWSBase.java:33)
    at cfbtestws.CFBTestWSUser.<init>(CFBTestWSUser.java:11)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    ...

  • Question about Creating DataSources for FlatFile Data Acquisition

    Hello eveyone,
    I am trying to create flatfile datasources.  I've been checking out the existing ds in my dev system and there are some infrastructure here that have loaded data in them, all via their won flatfile DS.  I've been looking at the DS and am trying to figure out logic in which they are defined. I saw that most of the fields are defined in CHAR even if they pertain to fields like quantity, Amount and so on...  They are also in the Internal format.  Yet they have been successfully loaded...
    My question is:  what are the rules of thumb in defining the DS?  How do i go about in mapping the fields to objects in the system?  Can anyone please give me the step-by-step scenario as to how to do this please?
    Many thanks,
    Philips

    Hi Philip,
    Pls. try the following steps ..may be helpful.
    1. when ever you want to create a flat file structure..keep in mind that, what are
        fields data available in your file. second thing is you need to know the IO of
        the info provider in which you are uploading.
    2. simply create your own DS with PC File, and other hand open up your infprovider, and keep on check with your flat file what is the sequence of the data
    fields and what are they corresponds to in the cube/ODS
    3. As your flat file sequence, keep on identify the related IO of your provider and
    copy it individual and paste it in your infosouce one by one as sequence of your
    flat file..
    4. No need to think of what type of data it is and how it is..
    5. simply copy all your correponding IO (what ever of their type) even including
        some of the ref. IO.
    6. And finally save and activate your DS creation.
    I hope it would help in creating your own Flat File DS.
    Need further info revert...
    Cheers,
    Thanks=Points.

  • Question regarding as Datasource

    Dear experts,
    I have another question. If I create a datasource in COPA in R/3, shall I create lots of other Master data datasource in R/3?
    For exemple, if i already have Article in the datasource from COPA. Should I still create another datasource for Article from LO-IS?
    Thanks!

    You must known at least the fields you are intersted in load to BW in order to search a datasource that contain them.....if you dont know the module you ned to extract you must search for help from a analyst that works on that module...when you find a datasource that contain ALL the fields you need you can use that...if doesn´t have ALL but only a few are missing.....you could try to enhace the datasource....if you can´t find a datasource with most of the fields you are interested in.... you can create a Z datasource and create an extractor for this.....
    I hope this helps you
    Regards

Maybe you are looking for