YearToDate MDX function with settings on date dimension in the design time

hi folks:
  I understand that in order to run YTD() function correctly, I need to set dimDate to Time type  in the designer . Here is the situation:
I have a user hierarchy, Fiscal Year - Fiscal Period - Fiscal week
for fiscal year and fiscal week attributes, I can find the related types in the dimensionAttribute property...however , for the fiscal period which is every four weeks, I can not find the proper type in the fiscal period dimensionAttribute property.
 What should I do in this case?
thanks
Hui
--Currently using Reporting Service 2000; Visual Studio .NET 2003; Visual Source Safe SSIS 2008 SSAS 2008, SVN --

Hi Hans,
Thank you for your question.  
I am trying to involve someone more familiar with this topic for a further look at this issue. Sometime delay might be expected from the job transferring. Your patience is greatly appreciated.  
Thank you for your understanding and support. 
Regards,
Simon Hou
TechNet Community Support

Similar Messages

  • Function Module to find date by passign the Planning Calendar

    Hi All,
    Can you tell me is there any function Module to find date by passign the Planning Calendar?
    The requirement is i have a planning calender assigned to the Material in the MRP2 view.
    Example: Material XXXXXX is assigned a Planning Calendar Z01.
    Z01 is defined such that Delivery is on Monday only. This calendar says that the material is received from the Vendor only on Mondays.
    So whenever i punch a Sales Order for Material XXXXXX, a PR is automatically geenrated when saving the sales order and the calculation of Delivery dates is also happening at this level.
    Basing on this PR a PO is raised to a Vendor for procuring the Material XXXXXX, now my problem is for example the PO is raised today (30.04.2008), but the Materail XXXXXX is available only on next monday in my plant (05.05.2008) basing on my Planning Calendar assigned in the Materail Master, so i have to inform this dealy to my customer at the time of punching the sales order.
    So is there any function Module to find date by passign the Planning Calendar?
    Thanks for your valuable inputs.
    Regards,
    Sudarshan

    Hi Jorge,
    Thanks for your reply.
    I am unable to open the Function module which you have mentioned below.
    I am working on 4.6 c version of SAP.
    Any ways i have found one function module which is useful to my requirement as stated below:
    DATE_GET_PERIOD
    Thanks and Regards,
    Sudarshan

  • How to use the function STRIP SILENCE on many regions at the same time?

    Hi,
    I am doing a projet with a lot (more thant 100) of audio regions, and I would like to use the function STRIP SILENCE on many regions at the same time (with the same parameters).
    Here is what happens :
    1- I select many regions (10 or so)
    2- I choose the function STRIP SILENCE in the AUDIO menu
    3- the window for stripping silence opens, and it tells me in it that there are 10 regions selected (if I selected 10)
    4- I put my parameters, then I click OK
    5- Only the first regions is done! all other regions are untouched.
    So... it this a bug or a feature? What am I doing wrong? Is it really working on multiple regions at the same time? If not, how could I do that besides doing the same operations 100 times!
    Could that be on the Intel bug that I see quite often ("it works on old Mac but not on Intel Mac")?
    Thanks,
    Daniel

    I think the message you get saying that 10 regions have been selected is not so much a bug as an oversight ---- someone didn't check to correlate the message with the actual functionality of strip silence (i.e., will only work on one region at a time).
    So the message is misleading.
    I find that it's best to set up a key command to perform the strip silence function. Makes the process go faster than having to mouse around. And I rarely find that the strip silence settings for one region work well on another, so I don't mind the fact that it only works to strip one region at a time.
    Sure, it would be cool if it performed the operation on multiple regions, but by using the same set of s/silence parameters for all regions there's always the chance that you might accidentally crop a region in the wrong way, meaning more time spent editing the beginning/end of those regions.

  • How to set up Airport Extreme with Charter ARRIS Modem TM902A for the first time for WIRELESS.

    How to set up Airport Extreme with Charter ARRIS Modem TM902A for the first time for WIRELESS.
    When Charter Tech goes to your site, have them connect the modem up, but do not connect the modem to your iMAC or MacBook Pro.  What you want to do is connect the Airport Extreme to the iMac or MacBook Pro first with the Ethernet Cable. You have to do this to configure via Airport Utility to set up the Base Station Name & Base Station Password.
    You will then create/configure a Wireless Network, create your Wireless Password that will be entered on each of your Devices, example, Apple Tv, your iPhone, etc., you want to allow access to your Wireless Network you are creating.
    Wireless Security will be -> WPA/WPA2 personal or just WPA2
    Enter the Wireless Password you want
    Verify the Wireless Password (enter it again)
    After it is created you will see it on the Airport Utility window with the name you created for it and to the left, will be a Dot (circle that will be yellow).
    Next you then want to unplug the power to the Airport Extreme, and then take the end of the Ethernet cable you unplugged from the iMac or Lap top MacBook Pro and connect it to the back of the Modem.
    Next unplug the power cord from the modem and wait about 5 minutes, then plug the power back into the Arris Modem and wait until all lights come back on the modem wait
    about 5 minutes, then plug the power cord back to the Airport Extreme and you will see it the light blinking yellow.  Wait about 5 to 10 minutes, during this time Restart you IMAC or MacBook Pro, and once it is back up click on the Airport Utility and you should see on the Airport Utility screen.
    For INTERNET to the left the light should be green and you should see the Airport Extreme also appear and the light to the left on the screen should also be green.  If they are, you then should be able to click on the Wireless Symbol on top of bar of the screen and click to select the Wireless Network Name you created.
    If you Do Not See the light (Icon) next to INTERNET turn Green, or if you see the Internet Light Green, but the Light (Icon) next to the Airport Extreme is yellow, unplug the power again to the modem and unplug the power again to the Airport extreme and wait about 15 minutes or up to 30 minutes. Then plug the power cord back to the modem wait till all the lights light up then, plug the power cord back into the Airport Extreme and Restart your iMAC or MacBook Pro.
    The Airport Extreme light should change from yellow to green. Open up the Airport Utility to see what the indicators are showing they should both be green.  Again select Wireless network you created under the Wireless Icon on the top right of the screen. Open Safari and see if you are able to Route to a web page or the apple site should appear.
    WHAT TO DO IF YOUR AIRPORT EXTREME WAS PREVIOUSLY SET UP FOR USE WITH ANOTHER CARRIERS ROUTER OR MODEM.
    NOTE:  If you already had your Airport Extreme connected for example, I previously had ATT Uverse and the Airport Extreme was connected to the Wireless Router Model 3801HGV, I disabled the Uverse Wireless and used the Airport Extreme for the Wireless signal in bridge mode, as the Airport extreme Signal is much stronger than the Uverse router, and I was able to obtain a Wireless signal with the Airport Extreme way much better with no signal loss which was very very frustrating with the Uverse router.
    Anyhow if you had it hooked up like this, now that you will be using it with the Charter ARRIS Modem TM902A, you will need to reset the Airport Extreme to clear out the old data it has in memory, with the previous set up otherwise it will not work. Trust me I spent 6 hours trying to make it work reading all Apple Support Community questions and answers relating to this type issue/problem others have been having trying to get their set up working. I tried all the tips, and I finally decided just to see if by chance I would be able to connect with someone with Charter Tech support who might be familiar with Apple to be able to assist me and by luck I did.  He told me why it was not working and was all due the previous configuration with the ATT Uverse router was still in memory with the Airport Extreme. Finally it was 10:30 PM when I decided to call Charter Tech Support and I had been working on this since 3:00 pm pacific. I did not call them earlier as all the post I read said they never received any good help from Charter. After calling them I finished up by 11:00 PM and was able to finally connect Apple Tv, iMac, iPhones and Macbook Pro. We love our Apple Product and Happy all is connected with the new
    Internet Provider Charter. I must say the speed is way way much better than it ever was with AT&T Uverse. 
    THIS IS WHAT YOU WILL NEED TO DO:
    First you will need to unplug the Airport Extreme, then by taking the tip of a pen or paper clip end you need to push the reset button on the back of the Airport Extreme and hold it
    down and at the same time plug the power cord back into the Airport Extreme count to 5 or 10 then release the reset button. Then once he light in front of the Airport Extreme stops blinking you need to plug the Ethernet cable from the Airport Extreme to your iMAC or Macbook Pro, and restart which ever one you have, then open the Airport Utility once it is back up.  If you see airport extreme pop up with the old network name or it shows and yellow triangle click on the Airport Extreme ICON it will not let you configure it but will ask if you want to get rid of it or remove and just do it.  Then Again restart your iMAC or MacBook Pro, open up Airport Utility again, and on the top left you should see under “Other Airport Base Stations” the MAC ID for the Airport Extreme.
    You will then create/configure a Wireless Network, create your Wireless Password that will be entered on each of your Devices, example, Apple TV, your iPhone, etc., you want to allow access to your Wireless Network you are creating.
    Wireless Security will be -> WPA/WPA2 personal or just WPA2
    Enter the Wireless Password you want
    Verify the Wireless Password (enter it again)
    After it is created you will see it on the Airport Utility window with the name you created for it and to the left, will be a Dot (circle that will be yellow).
    Next you then want to unplug the power to the Airport Extreme, and then take the end of the Ethernet cable you unplugged from the iMac or Lap top MacBook Pro and connect it to the back of the Modem.
    Next unplug the power cord from the modem and wait about 5 minutes, then plug the power back into the Arris Modem and wait until all lights come back on the modem wait
    about 5 minutes, then plug the power cord back to the Airport Extreme and you will see it the light blinking yellow.  Wait about 5 to 10 minutes, during this time Restart you IMAC or MacBook Pro, and once it is back up click on the Airport Utility and you should see on the Airport Utility screen.
    For INTERNET to the left the light should be green and you should see the Airport Extreme also appear and the light to the left on the screen should also be green.  If they are, you then should be able to click on the Wireless Symbol on top of bar of the screen and click to select the Wireless Network Name you created.
    If you Do Not See the light (Icon) next to INTERNET turn Green, or if you see the Internet Light Green, but the Light (Icon) next to the Airport Extreme is yellow, unplug the power again to the modem and unplug the power again to the Airport extreme and wait about 15 minutes or up to 30 minutes. Then plug the power cord back to the modem wait till all the lights light up then, plug the power cord back into the Airport Extreme and Restart your iMAC or MacBook Pro.
    The Airport Extreme light should change from yellow to green. Open up the Airport Utility to see what the indicators are showing they should both be green.  Again select Wireless network you created under the Wireless Icon on the top right of the screen. Open Safari and see if you are able to Route to a web page or the apple site should appear.

    I just got a Charter Modem. Model TM822. While I was moving, my Airport Extreme was still at my old place.
    I have a Linksys WRT320N I used for the initial Charter setup.
    I can get my Airport to work here, but the Internet light on the Modem flashes Yellow.
    Hasn't caused any issues so far but one thing I did notice.
    On the Linksys there were 3 DNS servers listed.
    The Airport Extreme only lists 2 and i don't see where I could add another, only change whats already there.
    I tried everything above, but light on modem still flashes yellow.
    I have the technicians cell phone. Told me "that shouldn't be" and gave the same advice listed above.
    I'll break down and call Charter one day, see if it's on their end. NSA tracking may need a reset LMAO.

  • Is there a way to work with two or more app at the same time on iPhone or iPad

    Is there a way to work with two or more app at the same time on iPhone or iPad?

    What i am attempting to achieve is to work with at least two app at the same time. For example: select any picture from my albums to attach them in an email. Another example is get data from an app to use it with the calc app. And there are more exaples for it. And for sure I need support for an iPad air. I mencioned the other tablet just to try to be a bit clearer.

  • Can't i use xml schema and oledb data connection at the same time?

    Hello to all and thanks in advance.I use xml schema and oledb data connection at the same time and the problem is that when I try to export the xml, the outcome is not what i expect.Without the oledb connection everything is ok (just the schema) and the xml complies with the schema.
    Can't i have both schema and oledb and the exported xml be as i want it?

    You can use both at the same time, but not gor Internet access if that's what you're asking.
    Now there is a thing called Link Aggregation, which combines a number of interfaces for speed/redundancy, but it really only works locally, and then only with ALL special equipment in the route, and most likely OSX Server involved.
    Sorry.

  • TS3276 Hi there I am having trouble with my outlook express this is the first time it has happened it keeps telling me can't connect to the SMTP server and every password I have tried is incorrect this is for 'iCloud' very frustrating as all our phones ar

    Hi there I am having trouble with my outlook express this is the first time it has happened it keeps telling me can't connect to the SMTP server and every password I have tried is incorrect this is for 'iCloud' very frustrating as all our phones are ok

    Well I am feeling a bit silly now because that was all I had to do. In the past Workgroup Manager had always opened right up to the list of my users, I never even thought to click on that but apparently that was all that was needed.
    I still am not sure how the iChat Server preferences changed themselves on me, but it is not the first time I have had weird "settings" issues with our Snow Leopard Server.
    Thanks!

  • Does Roaming data syncs for the first time when app data are in download and installation process?

    Hi,
    I will store user Id in "HighPriority" Roaming data. When user will install app in another computer (with the same Microsoft Account), app will get user Id from Roaming data. Then I can implement all data sync over my cloud service.
    There are 2 scenarios:
    1. User downloads and installs app in another computer, but roaming data syncs/downloads for the first time only after several minutes -
    It's bad for my app :(
    2. User downloads and installs app in another computer and roaming data syncs/downloads at the same time (then I can get user Id immediately)
    - Its great for my app :)
    Which scenario is real in practice?
    Does Roaming data syncs for the first time when app data are in download and installation process?

    Umm no not that i remember. It just randomly started happening. I reformatted the hard drive for mac (journaled) but it was working fine since i did it until now

  • HT5624 I've opened up iTunes and went to buy a song, but then it came up with a box saying "this is the first time you are purchasing an item on this computer" even though my computer is authorised. What do i do?

    I've opened up iTunes and went to buy a song, but then it came up with a box saying "this is the first time you are purchasing an item on this computer" even though my computer is authorised. Then when i put in my password it takes me to the security questions and i dont know what the answers are. What do i do?

    A computer can be authorized to play content purchased using a particular Apple ID (the iTunes Store account).  However, being authoized to play content is not directly related to being able to buy content using that Apple ID. 
    For example, a parent may purchase content for a child and authorize the child's computer to play that content, but that does not mean the child is able to purchase content using that Apple ID.
    If this is your Apple ID, you should know the answers to the security questions.  If you do not, you'll need to contact Apple iTunes Store customer support
    http://www.apple.com/support/itunes/contact/

  • "Semi/Non additive measure with" : "LastChild Across All Dimension" OR "LastChild Across Time and MAX across All Other Dimension"

    Hey All
    I am using the SQL SERVER 2008R2 standard edition so please be mindful when posting any suggestion if that will work on this edition or not.
    Here is the situation: I have Cube with one fact table "Positions". Measure I am querying is "AUM" and Dimensions across user can query are combinations of {"Portfolio", "Security" and "Time"}.
    I am receiving the "AUM" values at "portfolio+Security+Time" level. AUM is actually the Portfolio level value. so sample data I receive would like this.
    PORTFOLIO SECURITY TME AUM
    A SEC1 JAN-1 100
    A SEC2 JAN-1 100
    B SEC1 JAN-1 200
    B SEC3 JAN-1 200
    A SEC1 JAN-2 300
    A SEC2 JAN-2 300
    B SEC1 JAN-2 400
    B SEC3 JAN-2 400
    So, as shown in above example , we received same "AUM" value for a given portfolio and time. (regardless of what security value is).  
    And as AUM is the snapshot values, we can not sum across time as well, so if user is looking across time we need to pick Last values.
    Now when user wants to view this data from cube, two different ways s/he wants to look at it.
    option one: AUM at port+sec+time level. that is same as shown above in example.
    option two: AUM at portfolio level only,  (notice that this is across time so results are picking values for time=JAN-2)
    PORTFOLIO AUM
    A 300
    B 400
    GRAND TOTAL 700
    I have applied the "LastChild" aggregation property to measure to achieve "Do no Sum across Time "behavior. but with this I also get "SUM Across Except time" and hence my AUM values get summed across Portfolio and security as
    well. I have also enable Time Intelligence to enable MTD, YTD calculations.
    I tried to add SCOPE statement for Security before and after the "time calculations" yet I am not able to achieve expected behavior.
    here is the calculated member definition, and scope statement i have tried.
    CREATE MEMBER
    CURRENTCUBE.[MEASURES].[AUMNetBaseCurrency] AS
    [Measures].[AUMNetBaseCurrency_Raw_Max],
    FORMAT_STRING = "#,##0.00 ;( #,##0.00 )",
    VISIBLE = 1 , DISPLAY_FOLDER = 'Position';
    After this I have MTD and YTD time calculation for few measures including AUM.
    I tried placing the following SCOPE for AUM before and after the Time calculations but it no difference in result, in fact it seems like it has no affect of scope at all due to the "LastChild" aggregate property applied on measure.
    SCOPE([MEASURES].[AUMNetBaseCurrency]);
    SCOPE([Security].[Symbol].[All]);
    THIS = MAX([Measures].[AUMNetBaseCurrency_Raw_Max]);
    END SCOPE;
    END SCOPE;
    so options I am thinking of but do not have clear idea how to implement those are:
    0) why my Security Scope Statement are not showing any effect, and can we do something about it?
    1) Can be change "SUM" behavior to "MAX" / "MIN" across all Dimension except time.
    2) Is there a way to implement "LastChild" across all dimension instead only across Time.
    3) Should I need to make any changes at Fact table level to achieve this ? I refer one Q&A in this forum that suggested to create such measure in different measure group but it doesn't have any clarification.
    Any help would be appreciated.
    Thanks
    Anup Shah

    hi,
    you will have to enable cache in your nqsconfig.ini file under the section
    # Query Result Cache Section
    [ CACHE ]
    ENABLE     = YES;
    cache seeding is also a mechanism through which the data would be updated in the cache.

  • Test-OutlookConnectivity fails with '[Microsoft.Exchange.Data.Storage.WrongServerException]: The user and the mailbox are in different Active Directory sites'.

    I have a two site DAG, and the command is running from the alternate site where the databases are not currently being hosted. The following command...
    Test-OutlookConnectivity -Protocol:TCP -TrustAnySSLCert:$true -MonitoringContext:$true
    ...errors with the following output:
    An error occurred while trying to access mailbox CurrentlyHostingMBServerName.InternalDomainName, on behalf of user InternalDomainName\extest_bb13200232474
     Additional information:
     [Microsoft.Exchange.Data.Storage.WrongServerException]: The user and the mailbox are in different Active Directory sit
    es..
        + CategoryInfo          : OperationStopped: (Microsoft.Excha...onnectivityTask:TestOutlookConnectivityTask) [Test-
       OutlookConnectivity], CasHealthStorageErrorException
        + FullyQualifiedErrorId : F2F8AC0D,Microsoft.Exchange.Monitoring.TestOutlookConnectivityTask
    I thought this command would work based on the 'AllowCrossSiteRpcClientAccess: True' option on the DAG.  The command works well if run a CAS server in the active DB site.

    Hi,
    Exchange 2013 users use Outlook Anywhere to connect to CAS server. You may run the RCA to test the connectivity:
    https://www.testexchangeconnectivity.com/
    Thanks,
    Simon Wu
    TechNet Community Support

  • Function to compare tow dates and set the value

    Hi All,
     I have two dates with close date and Due date.And i want to set the value as 1 if close date is less then or equal to to due date else 0 .And my other condition is to set  1 when close date is greater the due date.Can any one help me how can I
    achieve it.
    Thanks, Sid

    Hello Sid,
    For this you can use a simple IF Statement with a compare on the Dates:
    = If(Tabelle1[CloseDate] <= Tabelle1[DueDate]; 1; 0)
    = IF(Tabelle1[CloseDate] > Tabelle1[DueDate]; 1; 0)
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • Can I sync my 'PC Free' activated iPhone with downloaded apps to iTunes for the first time without loosing data?

    I have an iPhone 4 that has been activated over the air, "PC Free" and have used it for a month without ever connecting it to a computer. I have downloaded several apps, taken a few pictures, and even downloaded a few songs. Now I want to connect to my computer and sync and backup. Will I loose all my data?

    Before you connect to a new PC, make sure that autosync is disabled in Edit/Preferences/Devices, otherwise her phone will be wiped during the following sync.
    If she has data on the phone she wants to save, back up manually:
    Disable autosync in iTunes, connect your phone to her new computer and right click on it in the device list and choose backup. iTunes will backup your phone without syncing. Transfer the purchases the same way, choosing "transfer purchases" this time.
    When you connect your phone for the first time, all media content will be erased. But you can restore your settings and app data from your manual backup afterwards.
    Don't forget to set up at least one contact and event on your new computer to be able to merge calendars and contacts when you sync the phone for the first time.
    About backups and what's saved:http://support.apple.com/kb/HT1766
    How to back up and restore:http://support.apple.com/kb/HT1414
    How to download apps for free again:http://support.apple.com/kb/HT2519
    Transferring data is also covered here: http://support.apple.com/kb/HT4137

  • I can't make my Apple TV to work both with wireless or hard wire at the same time

    I can't make my Apple TV to work both via wireless and hard wires Ethernet at the same time.

    Setup Apple TV with iPad
    1. Setup Apple TV
    (a) Connect cables and power cord
    (b) Turn on TV and select Input
    (c) Configure Apple TV e.g. Language, network
    2. Setup Home Sharing on iPad
    Settings>Music/Video>Home Sharing
    3. Setup Home Sharing on Apple TV
    Settings>Computer>Turn on Home Sharing. Enter Apple ID and Password
    4. Pair Apple TV with Remote Control
    General>Remotes>Pair Apple Remote

  • Can't access ejb with more than 1 person at the same time?

    I am using the ejb to access the database using DBConnection Pool that I find in book. The code is as follow:
    The problem is when more than one user access almost at the same time, the one who enter frst can access, but the other one can't and return context lookup error in creating EJB.
    What's the problem of it, is it the ejb concurrent access problem or database concurrent access problem?
    package login.database;
    import java.io.*;
    import java.sql.*;
    import java.util.*;
    import java.util.Date;
    public class DBConnectionManager {
    static private DBConnectionManager instance;
    static private int clients;
    private Vector drivers = new Vector();
    private PrintWriter log;
    private Hashtable pools = new Hashtable();
    static synchronized public DBConnectionManager getInstance() {
    if (instance == null) {
    instance = new DBConnectionManager();
    clients++;
    return instance;
    private DBConnectionManager() {
    init();
    public void freeConnection(String name, Connection con) {
    DBConnectionPool pool = (DBConnectionPool) pools.get(name);
    if (pool != null){
    pool.freeConnection(con);
    public Connection getConnection(String name) {
    DBConnectionPool pool = (DBConnectionPool) pools.get(name);
    if (pool != null) {
    return pool.getConnection();
    return null;
    public Connection getConnection(String name, long time) {
    DBConnectionPool pool = (DBConnectionPool) pools.get(name);
    if (pool != null) {
    return pool.getConnection(time);
    return null;
    public synchronized void release() {
    if (--clients != 0) {
    return;
    Enumeration allPools = pools.elements();
    while (allPools.hasMoreElements()) {
    DBConnectionPool pool = (DBConnectionPool) allPools.nextElement();
    pool.release();
    Enumeration allDrivers = drivers.elements();
    while (allDrivers.hasMoreElements()) {
    Driver driver = (Driver) allDrivers.nextElement();
    try {
    DriverManager.deregisterDriver(driver);
    log("Deregistered JDBC driver " + driver.getClass().getName());
    } catch (SQLException e) {
    log(e, "Can't deregister JDBC driver: " + driver.getClass().getName());
    private void createPools(Properties props) {
    Enumeration propNames = props.propertyNames();
    while (propNames.hasMoreElements()) {
    String name = (String) propNames.nextElement();
    if (name.endsWith(".url")) {
    String poolName = name.substring(0, name.lastIndexOf("."));
    String url = props.getProperty(poolName + ".url");
    if (url == null) {
    log("No URL specified for " + poolName);
    continue;
    String user = props.getProperty(poolName + ".user");
    String password = props.getProperty(poolName + ".password");
    String maxconn = props.getProperty(poolName + ".maxconn", "0");
    int max;
    try {
    max = Integer.valueOf(maxconn).intValue();
    } catch (NumberFormatException e) {
    log("Invalid maxconn value " + maxconn + "for " + poolName);
    max = 0;
    DBConnectionPool pool = new DBConnectionPool(poolName, url, user, password, max);
    pools.put(poolName, pool);
    log("Initialized pool " + poolName);
    private void init(){
    InputStream is = getClass().getResourceAsStream("db.properties");
    Properties dbProps = new Properties();
    try {
    dbProps.load(is);
    } catch (Exception e) {
    System.err.println("Can't read the properties file. " +
    "Make sure db.properties is in the CLASSPATH");
    return;
    String logFile = dbProps.getProperty("logfile","DBConnectionManager.log");
    try {
    log = new PrintWriter(new FileWriter(logFile, true), true);
    } catch (IOException e) {
    System.err.println("Can't open the log file: " + logFile);
    log = new PrintWriter(System.err);
    loadDrivers(dbProps);
    createPools(dbProps);
    private void loadDrivers(Properties props) {
    String driverClasses = props.getProperty("drivers");
    StringTokenizer st = new StringTokenizer(driverClasses);
    while (st.hasMoreElements()) {
    String driverClassName = st.nextToken().trim();
    try {
    Driver driver = (Driver) Class.forName(driverClassName).newInstance();
    DriverManager.registerDriver(driver);
    drivers.addElement(driver);
    log("Registered JDBC driver " + driverClassName);
    } catch (Exception e) {
    log("Can't register JDBC driver: " + driverClassName + ", Exception: " + e);
    private void log(String msg) {
    log.println(new Date() + ": " + msg);
    private void log(Throwable e, String msg) {
    log.println(new Date() + ": " + msg);
    e.printStackTrace(log);
    class DBConnectionPool {
    private int checkedOut;
    private Vector freeConnections = new Vector();
    private int maxConn;
    private String name;
    private String password;
    private String URL;
    private String user;
    public DBConnectionPool(String name, String URL, String user, String password, int maxConn) {
    this.name = name;
    this.URL = URL;
    this.user = user;
    this.password = password;
    this.maxConn = maxConn;
    public synchronized void freeConnection(Connection con) {
    freeConnections.addElement(con);
    checkedOut--;
    notifyAll();
    public synchronized Connection getConnection() {
    Connection con = null;
    if (freeConnections.size() > 0) {
    con = (Connection) freeConnections.firstElement();
    freeConnections.removeElementAt(0);
    try {
    if (con.isClosed()) {
    log("Removed bad connection from " + name);
    con = getConnection();
    } catch (SQLException e) {
    log("Removed bad connection from " + name);
    con = getConnection();
    else if (maxConn == 0 || checkedOut < maxConn) {
    con = newConnection();
    if (con != null) {
    checkedOut++;
    return con;
    public synchronized Connection getConnection(long timeout) {
    long startTime = new Date().getTime();
    Connection con;
    while ((con = getConnection()) == null) {
    try {
    wait(timeout);
    } catch (InterruptedException e) {}
    if ((new Date().getTime() - startTime) >= timeout) {
    return null;
    return con;
    public synchronized void release() {
    Enumeration allConnections = freeConnections.elements();
    while (allConnections.hasMoreElements()) {
    Connection con = (Connection) allConnections.nextElement();
    try {
    con.close();
    log("Closed connection for pool " + name);
    } catch (SQLException e) {
    log(e, "Can't close connection for pool " + name);
    freeConnections.removeAllElements();
    private Connection newConnection() {
    Connection con = null;
    try {
    if (user == null) {
    con = DriverManager.getConnection(URL);
    else {
    con = DriverManager.getConnection(URL, user, password);
    log("Created a new connection in pool " + name);
    } catch (SQLException e) {
    log(e, "Can't create a new connection for " + URL);
    return null;
    return con;

    Hi,
    static synchronized public DBConnectionManager getInstance() {
    The word "synchronized" will allow only one user at a time to access the getInstance() method which returns DBConnectionManager. Suggest u read some stuff on the same
    As I am not sure which App server ur using, u cld do the following
    1. Create a Conection Pool in ur App Server itself (Weblogic/Websphere/Jboss way)
    2. Create a DataSource which maps to this Connection Pool.
    3. Use the DataSource object which handles poolong of Connections to access the database
    4. As mentioned above, Read notes/documents on "Synchronized" and "Vector" before you use this word in any code of EJB. This will solve ur problem. Read topic called "Collection Framework".
    Seetesh

Maybe you are looking for

  • How to find process chain using background job in sm37

    How to find process chain using background job in sm37

  • If pic not found then show blank space

    SELECT '*'||a.Employee_code||'*' AS "BARCODE", a.Employee_code, 'D:\Pictures\'||a.employee_code||'.bmp' as pict,a.job_status, a.Employee_name, a.Designation_desc,a.new_nic_no, a.COMPANY_CODE, b.company_name,b.ADDRESS, a.location_code, c.location_name

  • [Urgent] KMODE Exception

    Hi All, I have this serious problem launching java applications on one of the machines at my office, the jdk1.3.1 works fine but when I use j2sdk1.4.1_05 or higher I get BSOD (KMODE_EXCEPTION) and system crashes.Can anyone help me on this? ** Not eve

  • Form errors. How to understand and fix them, any help?

    Hello, I have been getting multiple errors in a form I created, I copied and pasted items from another form and change the content. Here is what I am seeing, anyone have suggestions on how I can fix this?

  • ERROR: Device '/dev/sda3' not found.

    This is my first time compiling a custom kernel. I am trying to compile zen kernel 3.12.3. Whenever I try to boot it up, it says this:                 ERROR: device '/dev/sda3' not found. Skipping fsck                 ERROR: Unable to find root devic