[Urgent] Interruption of access to the Table Storage

Hi,
We have a code that takes a record from Table Storage (placed below).
This works perfect but since some moment it is always return null.
But using VS tools I can see there are records in table.
Please help us to solve this issue asap.
StorageCredentials creds = new StorageCredentials(storageName, key);
CloudStorageAccount account = new CloudStorageAccount(creds, useHttps: true);
CloudTableClient client = account.CreateCloudTableClient();
table = client.GetTableReference("ClientMetadata");
var query = new TableQuery<AzMetadataItem>().Take(1);
res = await table.ExecuteQuerySegmentedAsync<AzMetadataItem>(query, null).ConfigureAwait(false);
metadata = (AzMetadataItem)res.FirstOrDefault();

Segmented queries can return less number of records than your app requested. You have to use the continuation token returned by the segmented query and use it for the next segmented query request until you get all the records you need.

Similar Messages

  • How do you access all the tables in print layout designer?

    Hello, I noticed that I can access only the main tables such as OPOR or ORDR tables, but how can I access POR1 or RDR1?
    Any help is appreciated, thank you.

    Please press the ALT key when you click the Table drop down list.

  • URGENT: How to find out the Tables for Routines  in BW.

    Hi BW Gurus,
    How to find out the Tables for Routines  in BW.
    I have this routine id <b>45XFAEI7LKIFIRDUKQG127YWW</b> and it is in inactive state and i want to activate it.
    thanks in advance,
    points will be rewarded.
    Regards,
    Maruthi.

    Hi Maruthi,
    Check table RSUPDROUT using the routine id as input for the field CODEID. You will get the technical name of the update rule.
    Cheers,
    Praveen.

  • Urgent please help: what is the table name for cash management reports?

    I am wondering what the table name for cash management reports is. I am trying to figure out then if I have any missing.
    Please help.

    I checked MSEG table. But, I didn't find any field for date.
    Can you tell me field name.
    Regards
    Siva

  • Disable access to the cloud storage feature for Creative Cloud for Teams?

    Is it possible to disable access to Creative Cloud Files when using Creative Cloud software for Teams/Volume Licensing customers? We're considering moving to Creative Cloud subscriptsions instead of traditional licensing and the ability to turn this feature off would be the easiest way to comply with our company's security requirments.
    Thanks.

    BrickyB, This is what the Creative Cloud FAQ says,
    My organization wants to block access to certain services, such as storage and access to community features, available through Creative Cloud. Is this possible?
    Yes, your IT administrators can block users from accessing the online services.  The online services and their URLs are listed here.
    As an administrator, you will also be able to deploy Creative Cloud desktop applications independent of the cloud-based services using the Creative Cloud Packager. The Creative Cloud Packager is available through Creative Cloud for teams.
    Check this for more details.
    http://www.adobe.com/products/creativecloud/faq.html

  • Number accesses to the table

    Hello,
    how can I get the number of accesses to a particular table
    Best Regards
    Francesco

    user12065233 wrote:
    Hello,
    how can I get the number of accesses to a particular table
    Best Regards
    FrancescoAccess as defined as?
    When you define that, check and see if auditing fulfills your requirements for your version of Oracle (which you didn't feel like sharing with us for some reason, it can actually make a huge difference in the applicability of the answers you get).
    http://tahiti.oracle.com/
    Pick your version and search away for Auditing.

  • Oracle Table Storage Parameters - a nice reading

    bold Gony's reading excercise for 07/09/2009 bold -
    The below is from the web source http://www.praetoriate.com/t_%20tuning_storage_parameters.htm. Very good material.The notes refers to figures and diagrams which cannot be seen below. But the text below is ver useful.
    Let’s begin this chapter by introducing the relationship between object storage parameters and performance. Poor object performance within Oracle is experienced in several areas:
    Slow inserts Insert operations run slowly and have excessive I/O. This happens when blocks on the freelist only have room for a few rows before Oracle is forced to grab another free block.
    Slow selects Select statements have excessive I/O because of chained rows. This occurs when rows “chain” and fragment onto several data blocks, causing additional I/O to fetch the blocks.
    Slow updates Update statements run very slowly with double the amount of I/O. This happens when update operations expand a VARCHAR or BLOB column and Oracle is forced to chain the row contents onto additional data blocks.
    Slow deletes Large delete statements can run slowly and cause segment header contention. This happens when rows are deleted and Oracle must relink the data block onto the freelist for the table.
    As we see, the storage parameters for Oracle tables and indexes can have an important effect on the performance of the database. Let’s begin our discussion of object tuning by reviewing the common storage parameters that affect Oracle performance.
    The pctfree Storage Parameter
    The purpose of pctfree is to tell Oracle when to remove a block from the object’s freelist. Since the Oracle default is pctfree=10, blocks remain on the freelist while they are less than 90 percent full. As shown in Figure 10-5, once an insert makes the block grow beyond 90 percent full, it is removed from the freelist, leaving 10 percent of the block for row expansion. Furthermore, the data block will remain off the freelist even after the space drops below 90 percent. Only after subsequent delete operations cause the space to fall below the pctused threshold of 40 percent will Oracle put the block back onto the freelist.
    Figure 10-83: The pctfree threshold
    The pctused Storage Parameter
    The pctused parameter tells Oracle when to add a previously full block onto the freelist. As rows are deleted from a table, the database blocks become eligible to accept new rows. This happens when the amount of space in a database block falls below pctused, and a freelist relink operation is triggered, as shown in Figure 10-6.
    Figure 10-84: The pctused threshold
    For example, with pctused=60, all database blocks that have less than 60 percent will be on the freelist, as well as other blocks that dropped below pctused and have not yet grown to pctfree. Once a block deletes a row and becomes less than 60 percent full, the block goes back on the freelist. When rows are deleted, data blocks become available when a block’s free space drops below the value of pctused for the table, and Oracle relinks the data block onto the freelist chain. As the table has rows inserted into it, it will grow until the space on the block exceeds the threshold pctfree, at which time the block is unlinked from the freelist.
    The freelists Storage Parameter
    The freelists parameter tells Oracle how many segment header blocks to create for a table or index. Multiple freelists are used to prevent segment header contention when several tasks compete to INSERT, UPDATE, or DELETE from the table. The freelists parameter should be set to the maximum number of concurrent update operations.
    Prior to Oracle8i, you must reorganize the table to change the freelists storage parameter. In Oracle8i, you can dynamically add freelists to any table or index with the alter table command. In Oracle8i, adding a freelist reserves a new block in the table to hold the control structures. To use this feature, you must set the compatible parameter to 8.1.6 or greater.
    The freelist groups Storage Parameter for OPS
    The freelist groups parameter is used in Oracle Parallel Server (Real Application Clusters). When multiple instances access a table, separate freelist groups are allocated in the segment header. The freelist groups parameter should be set the number of instances that access the table. For details on segment internals with multiple freelist groups, see Chapter 13.
    NOTE: The variables are called pctfree and pctused in the create table and alter table syntax, but they are called PCT_FREE and PCT_USED in the dba_tables view in the Oracle dictionary. The programmer responsible for this mix-up was promoted to senior vice president in recognition of his contribution to the complexity of the Oracle software.
    Summary of Storage Parameter Rules
    The following rules govern the settings for the storage parameters freelists, freelist groups, pctfree, and pctused. As you know, the value of pctused and pctfree can easily be changed at any time with the alter table command, and the observant DBA should be able to develop a methodology for deciding the optimal settings for these parameters. For now, accept these rules, and we will be discussing them in detail later in this chapter.
    There is a direct trade-off between effective space utilization and high performance, and the table storage parameters control this trade-off:
    For efficient space reuse A high value for pctused will effectively reuse space on data blocks, but at the expense of additional I/O. A high pctused means that relatively full blocks are placed on the freelist. Hence, these blocks will be able to accept only a few rows before becoming full again, leading to more I/O.
    For high performance A low value for pctused means that Oracle will not place a data block onto the freelist until it is nearly empty. The block will be able to accept many rows until it becomes full, thereby reducing I/O at insert time. Remember that it is always faster for Oracle to extend into new blocks than to reuse existing blocks. It takes fewer resources for Oracle to extend a table than to manage freelists.
    While we will go into the justification for these rules later in this chapter, let’s review the general guidelines for setting of object storage parameters:
    Always set pctused to allow enough room to accept a new row. We never want to have a free block that does not have enough room to accept a row. If we do, this will cause a slowdown since Oracle will attempt to read five “dead” free blocks before extending the table to get an empty block.
    The presence of chained rows in a table means that pctfree is too low or that db_block_size is too small. In most cases within Oracle, RAW and LONG RAW columns make huge rows that exceed the maximum block size for Oracle, making chained rows unavoidable.
    If a table has simultaneous insert SQL processes, it needs to have simultaneous delete processes. Running a single purge job will place all of the free blocks on only one freelist, and none of the other freelists will contain any free blocks from the purge.
    The freelist parameter should be set to the high-water mark of updates to a table. For example, if the customer table has up to 20 end users performing insert operations at any time, the customer table should have freelists=20.
    The freelist groups parameter should be set the number of Real Application Clusters instances (Oracle Parallel Server in Oracle8i) that access the table.

    sb92075 wrote:
    goni ,
    Please let go of 20th century & join the rest or the world in the 21st century.
    Information presented is obsoleted & can be ignored when using ASSM & ASSM is default with V10 & V11I said the same over here for the exactly same thread, not sure what the heck OP is upto?
    Oracle Table Storage Parameters - a nice reading
    regards
    Aman....

  • When it is beter to buffer the table

    hi
    when it is beter to buffer the table

    Hi
    <b>Table buffering</b>
    Advantages of buffering
    Concept of buffering
    Buffering types
    Buffer synchronization
    <b>Database access using Buffer concept</b>
    Buffering allows you to access data quicker by letting you
    access it from the application server instead of the database.
    <b>Advantages of buffering</b>
    Table buffering increases the performance when the records of the table are read.
    As records of a buffered table are read directly from the local buffer of the application server on which the accessing transaction is running, time required to access data is greatly reduced. The access improves by a factor of 10 to 100 depending on the structure of the table and on the exact system configuration.
    If the storage requirements in the buffer increase due to further data, the data that has not been accessed for the longest time is displaced. This displacement takes place asynchronously at certain times which are defined dynamically based on the buffer accesses. Data is only displaced if the free space in  the buffer is less than a predefined value or the quality of the access is not satisfactory at this time.
    Entering $TAB in the command field resets the table buffers on the corresponding application server. Only use this command if there are inconsistencies in the buffer. In large systems, it can take several hours to fill the buffers. The performance is considerably reduced during this time.
    <b>Concept of buffering</b>
    The R/3 System manages and synchronizes the buffers on the individual application servers. If an application program accesses data of a table, the database interfaces determines whether this data lies in the buffer of the application server. If this is the case, the data is read directly from the buffer. If the data is not in the buffer of the application server, it is read from the database and loaded into the buffer. The buffer can therefore satisfy the next access to this data.
    The buffering type determines which records of the table are loaded into the buffer of the application server when a record of the table is accessed. There are three different buffering types.
    With full buffering, all the table records are loaded into the buffer when one record of the table is accessed.
    With generic buffering, all the records whose left-justified part of the key is the same are loaded into the buffer when a table record is accessed.
    With single-record buffering, only the record that was accessed is loaded into the buffer.
    <b>Buffering types</b>
    With full buffering, the table is either completely or not at all in the buffer. When a record of the table is accessed, all the records of the table are loaded into the buffer.
    When you decide whether a table should be fully buffered, you must take the table size, the number of read accesses and the number of write accesses into consideration. The smaller the table is, the more frequently it is read and the less frequently it is written, the better it is to fully buffer the table.
    Full buffering is also advisable for tables having frequent accesses to records that do not exist. Since all the records of the table reside in the buffer, it is already clear in the buffer whether or not a record exists.
    The data records are stored in the buffer sorted by table key. When you access the data with SELECT, only fields up to the last specified key field can be used for the access. The left-justified part of the key should therefore be as large as possible for such accesses. For example, if the first key field is not defined, the entire table is scanned in the buffer. Under these circumstances, a direct access to the database could be more efficient if there is a suitable secondary index there.
    With generic buffering, all the records whose generic key fields agree with this record are loaded into the buffer when one record of the table is accessed. The generic key is a left-justified part of the primary key of the table that must be defined when the buffering type is selected. The generic key should be selected so that the generic areas are not too small, which would result in too many generic areas. If there are only a few records for each generic area, full buffering is usually preferable for the table. If you choose too large a generic key, too much data will be invalidated if there are changes to table entries, which would have a negative effect on the performance.
    A table should be generically buffered if only certain generic areas of the table are usually needed for processing.
    Client-dependent, fully buffered tables are automatically generically buffered. The client field is the generic key. It is assumed that not all of the clients are being processed at the same time on one application server. Language-dependent tables are a further example of generic buffering. The generic key includes all the key fields up to and including the language field.
    The generic areas are managed in the buffer as independent objects. The generic areas are managed analogously to fully buffered tables. You should therefore also read the information about full buffering.
    Single-record buffering is recommended particularly for large tables in which only a few records are accessed repeatedly with SELECT SINGLE. All the accesses to the table that do not use SELECT SINGLE bypass the buffer and directly access the database.
    If you access a record that was not yet buffered using SELECT SINGLE, there is a database access to load the record. If the table does not contain a record with the specified key, this record is recorded in the buffer as non-existent. This prevents a further database access if you make another access with the same key
    You only need one database access to load a table with full buffering, but you need several database accesses with single-record buffering. Full buffering is therefore generally preferable for small tables that are frequently accessed.
    <b>Synchronizing local buffers</b>
    The table buffers reside locally on each application server in the system. However, this makes it necessary for the buffer administration to transfer all changes made to buffered objects to all the application servers of the system.
    If a buffered table is modified, it is updated synchronously in the buffer of the application server from which the change was made. The buffers of the whole network, that is, the buffers of all the other application servers, are synchronized with an asynchronous procedure.
    Entries are written in a central database table (DDLOG) after each table modification that could be buffered. Each application server reads these entries at fixed time intervals.
    If entries are found that show a change to the data buffered by this server, this data is invalidated. If this data is accessed again, it is read directly from the database. In such an access, the table can then be loaded to the buffer again.
    <b>Using buffered tables improves the performance considerably.</b>
    Bypassing the buffer increases the network considerably
    SELECT SINGLE * FROM T100 INTO T100_WA
      BYPASSING BUFFER
      WHERE     SPRSL = 'D'
            AND ARBGB = '00'
            AND MSGNR = '999'.
    The above mentioned code can be more optimized by using the following code
    SELECT SINGLE * FROM T100  INTO T100_WA
      WHERE     SPRSL = 'D'
            AND ARBGB = '00'
            AND MSGNR = '999'.
    <b>Optimizing the load of the database</b>
    <b>Using table buffering</b>
         Using buffered tables improves the performance considerably. Note that in some cases a statement can not be used with a buffered table, so when using these statements the buffer will be bypassed. These statements are:
    Select DISTINCT
    ORDER BY / GROUP BY / HAVING clause
    Any WHERE clause that contains a sub query or IS NULL expression
    JOIN s
    A SELECT... FOR UPDATE
         If you wan t to explicitly bypass the buffer, use the BYPASS BUFFER addition to the SELECT clause.
    <b>Reward if useful</b>

  • If I subscribe to iTunes Match and later don't renew, will that impact the songs I've stored on my PC or phone or only the central storage in iCloud?

    If I subscribe to iTunes Match and later don't renew, will that impact my access to music I have stored on my devices or will it only end my access to the central storage in iCloud?  Thank you!

    It won't delete anything in your iTunes library on your computer but you would lose access to anything in your iTunes Match library that isn't stored in your iTunes library on your computer.  You would obviously need to sync your music to your phone from your computer using iTunes again.

  • Buffering the table

    guyz!
    hope this post finds u all at high on spirit. over here, i am having a requirement to buffer one custom table. let me give the scenario of table access. here it goes:
    1. it gets updated every month.
    2. after getting updated, it is accessed.
    3. i also believe that, table size is also small, i.e. size category  = 0.
    4. finally the access is like, mostly it will retreive only one month data, by taking all the key fields. in my case there are 5 key fields.
    so can any one suggest me, which buffering type to use.
    manas

    Hi,
    select 'Buffering not allowed ' button for mentioned case.
    Check this help:
    Buffering status
    Definition
    The buffering status specifies whether or not a table may be buffered.
    This depends on how the table is used, for example on the expected volume of data in the table or on the type of access to a table. (mainly read or mainly write access to the table. In the latter case, for example, one would not select buffering).
    You should therefore select
    - Buffering not allowed if a table may not be buffered.
    - Buffering allowed but not activated if buffering is
      principally allowed for a table, but at the moment no buffering
      should be active. The
    buffering type specified in this case is only
      a suggestion.
    - Buffering allowed if the table should be buffered. In this
      case a buffering type
    must be specified.
    The buffering type defines whether and how the table should be buffered.
    There are the following types of buffering:
    single-record buffering
    generic area buffering
    full buffering
    In generic area buffering, a number of key fields between 1 and no. of key fields-1 must be specified.
    Regards
    Appana

  • Table storage got 4 times slower from day to day

    Hi, I've run tasks which added data to the table storage on my cloudapp each night for the last months, but since Friday 13th (yeah 13th, thats what I thought), the tasks have been executing 4 times slower.
    The exact Work being done, is around 250,000 calls to 'ExecuteBatch' split up on three workers - thursday I got around 20 ops, and since Friday I've been getting around 5 ops. See the storage graph below. It clearly shows that the requests has dropped
    significantly...
    Does the azure table storage limit bandwidth in some cases, or what could have happened?
    Has anyone experienced this or something similar before?

    Hi APMadsen,
    I guess the azure table storage may be affected by larger and larger data. If so, I suggest you could pay attention to your query code and spend on the query code optimization (refer to this thread
    http://social.msdn.microsoft.com/Forums/windowsazure/en-US/5326d280-513f-47a3-826d-2db97ebd9ace/why-is-this-azure-table-storage-query-so-slow). Also, I suggest you could refer to this big data sample (http://www.troyhunt.com/2013/12/working-with-154-million-records-on.html
    ) and this blog (http://robertgreiner.com/2012/06/why-is-azure-table-storage-so-slow/ ).
    Hope it helps.
    Will
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • 403 Error when access Table Storage using SAS token

    I have Azure Mobile Service which has a custom API to generate a sas token for accessing Table Storage from Windows Store app.
    I get following error in Windows Store app while accessing table storage using sas token:
    Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
    Example of sas token generated:
    se=2014-09-12T03%3A10%3A00Z&sp=rw&spk=MicrosoftAccount%3A005d92ef08ec5d83081afed1e08641d2&epk=MicrosoftAccount%3A005d92ef08ec5d83081afed1e08641d2&sv=2014-02-14&tn=Folders&sig=91c7S1QM0byNdM80JncwRribXqsWS1iKmOH8cRvHWhQ%3D
    Azure Mobile Services API Code that generates sas token:
    exports.get = function(request, response) {
    var azure = require('azure-storage');
    var accountName = 'myAccountName';
    var accountKey = 'myAccountKey';
    var host = accountName + '.table.core.windows.net';
    var tableService = azure.createTableService(accountName, accountKey, host);
    var sharedAccessPolicy = {
    AccessPolicy: {
    Permissions: 'rw', //Read and Write permissions
    Expiry: dayFromNow(1),
    StartPk: request.user.userId,
    EndPk: request.user.userId
    var sasToken = tableService.generateSharedAccessSignature('myTableName', sharedAccessPolicy);
    response.send(statusCodes.OK, { sasToken : sasToken });
    function dayFromNow(days){
    var result = new Date();
    result.setDate(result.getDate() + days);
    return result;
    Windows Store app code that uses sas token:
    public async Task TestSasApi()
    try
    var tableEndPoint = "https://myAccount.table.core.windows.net";
    var sasToken = await this.MobileService.InvokeApiAsync<Azure.StorageSas>("getsastoken", System.Net.Http.HttpMethod.Get, null);
    StorageCredentials storageCredentials = new StorageCredentials(sasToken);
    CloudTableClient tableClient = new CloudTableClient(new Uri(tableEndPoint), storageCredentials);
    var tableRef = tableClient.GetTableReference("myTableName");
    TableQuery query
    = new TableQuery().Where(TableQuery.GenerateFilterCondition("PartitionKey",
    QueryComparisons.Equal,
    this.MobileService.CurrentUser.UserId));
    TableQuerySegment seg = await tableRef.ExecuteQuerySegmentedAsync(query, null);
    foreach (DynamicTableEntity ent in seg)
    string str = ent.ToString();
    catch (Exception ex)
    string msg = ex.Message;
    Exception:
    Any help is appreciated.
    Thanks in advance!
    Thanks, Vinod Shinde

    Hi Mekh,
    Thanks for the links. I checked them and mostly they are due to date time on client and server.
    But this is not the case in this scenario.
    here is the Request and Response from Fiddler.
    Request:
    GET
    https://myaccount.table.core.windows.net/Folders?se=2014-09-13T02%3A33%3A26Z&sp=rw&spk=MicrosoftAccount%3A005d92ef08ec5d83081afed1e08641d2&epk=MicrosoftAccount%3A005d92ef08ec5d83081afed1e08641d2&sv=2014-02-14&tn=Folders&sig=YIwVPHb2wRShiyE2cWXV5hHg0p4FwQOGmWBHlN3%2FRO8%3D&api-version=2014-02-14&$filter=PartitionKey%20eq%20%27MicrosoftAccount%3A005d92ef08ec5d83081afed1e08641d2%27
    HTTP/1.1
    Accept: application/atom+xml, application/xml
    Accept-Charset: UTF-8
    MaxDataServiceVersion: 2.0;NetFx
    x-ms-client-request-id: b5d9ab61-5cff-498f-94e9-437694e9256c
    User-Agent: WA-Storage/4.2.1 (Windows Runtime)
    Host: todoprime.table.core.windows.net
    Response:
    HTTP/1.1 403 Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
    Content-Length: 437
    Content-Type: application/xml
    Server: Microsoft-HTTPAPI/2.0
    x-ms-request-id: 22c0543b-0002-0049-7337-da39f4000000
    Date: Thu, 11 Sep 2014 02:33:28 GMT
    <?xml version="1.0" encoding="utf-8" standalone="yes"?>
    <error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
      <code>AuthenticationFailed</code>
      <message xml:lang="en-US">Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
    RequestId:22c0543b-0002-0049-7337-da39f4000000
    Time:2014-09-11T02:33:29.6520060Z</message>
    </error>
    Do you see anything different in this request/response?
    Thanks, Vinod Shinde

  • Is this the best design for asynchronous notifications (such as email)? Current design uses Web Site, Azure Service Bus Queue, Table Storage and Cloud Service Worker Role.

    I am asking for feedback on this design. Here is an example user story:
    As a group admin on the website I want to be notified when a user in my group uploads a file to the group.
    Easiest solution would be that in the code handling the upload, we just directly create an email message in there and send it. However, this seems like it isn't really the appropriate level of separation of concerns, so instead we are thinking to have a separate
    worker process which does nothing but send notifications. So, the website in the upload code handles receiving the file, extracting some metadata from it (like filename) and writing this to the database. As soon as it is done handling the file upload it then
    does two things: Writes the details of the notification to be sent (such as subject, filename, etc...) to a dedicated "notification" table and also creates a message in a queue which the notification sending worker process monitors. The entire sequence
    is shown in the diagram below.
    My questions are: Do you see any drawbacks in this design? Is there a better design? The team wants to use Azure Worker Roles, Queues and Table storage. Is it the right call to use these components or is this design unnecessarily complex? Quality attribute
    requirements are that it is easy to code, easy to maintain, easy to debug at runtime, auditable (history is available of when notifications were sent, etc...), monitor-able. Any other quality attributes you think we should be designing for?
    More info:
    We are creating a cloud application (in Azure) in which there are at least 2 components. The first is the "source" component (for example a UI / website) in which some action happens or some condition is met that triggers a second component or "worker"
    to perform some job. These jobs have details or metadata associated with them which we plan to store in Azure Table Storage. Here is the pattern we are considering:
    Steps:
    Condition for job met.
    Source writes job details to table.
    Source puts job in queue.
    Asynchronously:
    Worker accepts job from queue.
    Worker Records DateTimeStarted in table.
    Queue marks job marked as "in progress".
    Worker performs job.
    Worker updates table with details (including DateTimeCompleted).
    Worker reports completion to queue.
    Job deleted from queue.
    Please comment and let me know if I have this right, or if there is some better pattern. For example sake, consider the work to be "sending a notification" such as an email whose template fields are filled from the "details" mentioned in
    the pattern.

    Hi,
    Thanks for your posting.
    This development mode can exclude some errors, such as the file upload complete at the same time... from my experience, this is a good choice to achieve the goal.
    Best Regards,
    Jambor  
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How can I restrict more then one user to access the table?

    Hi !
    I have a problem and two solutions and I am a bit confused as to
    which one is the best one and/or can there be any better way of
    handling the problem ?
    Problem : I have to update a key field of a table when I update
    it in the form 5.0 screen. I am basically doing a maintenance of
    a table and if a certain field is updated then the change has to
    be reflected in two more tables. But the issue is that the field
    is a part of the key in those two tables. So all I can think of
    is that I need to insert new set or rows for that new value of
    the field and delete the old set of records for old values of
    the field.
    There are two ways of doing it;
    1.One option can be to explicitely define two cursors separately
    and fetch the values in them one by one and then insert the new
    records and then delete the old records in both the tables. This
    I feel will be a cumbersome process both in terms of processing
    time and the coding.
    2.Second option I was thinking can be to create two flat tables
    (without keys) and insert the values in them and update the
    changed field there and then insert the rows in the respective
    tables. Delete the old records in the main tables and delets the
    records in these flat tables. This is a bit more faster and
    easier to predict and code. This seems to be a better option for
    me.
    Any comments on these ?
    In both the cases I was thinking of making some provision so
    that more then one person can't update the table simultaneously.
    Since if there are more then one persons doing the processing
    then some inconsistency might creep into the whole process.
    This is easier to do in the second process as if I check the
    data in the flat tables and if there is some data then I can
    presume that some one is doing the processing and I can ask the
    other person to hold for a while. But in this case how can I
    stop more then two people to simultaneously check for the empty
    table and start inserting the record ?
    I was just thinking of having a sepatare table having only one
    field and this will be a key field and as the process begins the
    process will insert a fix value say 'Y' in the key field and at
    the end of the process the record will be deleted and this way
    we can restrict the user to access the process more then one at
    a time..? Since you can't have same value of the key in a table
    more then once.
    Any better way of handling it will be deeply appreciated.
    How about locking the table at the begining and releasing the
    lock at the end ? Will there be any issue in that? since I am
    inserting and deleting the rows in the same transaction.
    Comments welcome,
    Shobhit
    null

    How about performing the update IN the database using a stored
    procedure?
    By using non-database fields on your form to get the
    information, you can then call the procedure in the database to
    perform the updates. If an error occurs in the procedure you
    rollback, if necessary, and send a message or status back to the
    form. If it succeeds you might wish to commit and then re-
    execute the form's query -- using either the original key values
    or the new key values...
    null

  • Getting the table names in an MS Access database

    Hi,
    I am new to JDBC and making a client/server application that updates a MS Access database through jdbc:odbc.
    I need to get a list of existing user tables in the db. I have found a great document on the net which has the code, however the code doesn't work. I have tried different ways and looked every where with no success. (link to the doco: http://www-128.ibm.com/developerworks/opensource/library/j-jdbc-objects/)
    Here is my dbManager class that handles all db related services in my application. I would appreciate any help I can get as I have exhusted all my avenues.
    Thanks
    Sep,
    * dbManager.java
    * Created on 31 October 2005, 10:20
    * To change this template, choose Tools | Options and locate the template under
    * the Source Creation and Management node. Right-click the template and choose
    * Open. You can then make changes to the template in the Source Editor.
    import java.io.*;
    import java.sql.*;
    import java.util.regex.*;
    * @author AUMahdavSe
    public class dbManager {
        /** Constant Declaration                */
        public static final String Driver = "sun.jdbc.odbc.JdbcOdbcDriver";
        public static final
            String sqlCreateTable = "create table TABLENAME (" +
                "name varchar (100)," +
                "surname varchar(100)," +
                "computerType integer," +
                "computerNAL varchar(20)," +
                "haveMonitor integer," +
                "monitorNAL varchar (20)," +
                "auditDate varchar(10) );";
        public static final String sqlUpdateTable = "insert into TABLENAME values" +
                " (NAMEHOLDER, SURNAMEHOLDER, COMPTYPE, COMPNAL, HAVEMON, MONNAL);";
        /** Attributes                          */
        private String dbURL = "jdbc:odbc:";
        private String Username = "admin";  // user input
        private String Password = "purina123";  // user input
        private String ODBCDataSource;  // config file
        private String dbPath;  // set through config file or defaults to current folder
        private String configFile = "config.txt"; // set either at commandline or defaults to current folder
        private Connection con = null;
        private Statement stmt = null;
        private ResultSet tables;
        private DatabaseMetaData dma;
        private ResultSetMetaData rsmd;
        private String CurrentAuditTable = "TestTable2";
        int numCols, i;
        /** Set Methodes                        */
        public void setUsername( String usr ) {
            this.Username = usr;
        public void setPassword( String pswd ) {
            this.Password = pswd;
        public void setDbPath( String path ) {
            this.dbPath = path;
        public void setODBCDataSource( String ds ) {
            this.ODBCDataSource = ds;
        public void setDbURL( String dsname ) {
            this.dbURL = this.dbURL + dsname;
        /** Get Methodes                        */
        public String getDriver() {
            return this.Driver;
        // can be run only after a connection obj is setup
        public void getMDA() {
            try {
                this.dma = this.con.getMetaData();           
            catch (SQLException ex) {
                System.err.println("database connection: " + ex.getMessage());
        public void getDBTables() {
            //now dump out the names of the tables in the database
            String[] types = new String[1];
            types[0] = "TABLES"; //set table type mask
            //note the %-sign is a wild card (not '*')
            try {
                this.tables = this.dma.getTables(null, null, "%", types);
                dumpResults("--Tables--");
                this.tables.close();
                //this.listTables();
            catch (SQLException ex) {
                System.err.println("database connection: " + ex.getMessage());
            // listing tables
            /*int count = 0;
            int numCols = 0;
            //ResultSetMetaData rsmd;
            try {
                System.out.println("Listing db tables ...");
                //this.tables.beforeFirst();
                rsmd = this.tables.getMetaData();
                numCols = rsmd.getColumnCount();
                System.out.println("number of cols: " + numCols);
                boolean more = this.tables.first();
                System.out.println("this is why: " + more);
                while ( more ) {
                    count++;
                    for (int i = 1; i <= numCols; i++)
                        System.out.print( "Table-" + count + " -> " + this.tables.getString(count)+"    " );
                    System.out.println();
                    more = this.tables.next();
            catch ( SQLException ex ) {
                System.out.println( "problem listing db tables: " + ex.getMessage() );
        /** Other Methodes                      */
        // Initialize the db parameters, like driver, username, passwd, etc.
        public void dbInitialize() {
            // load configuration from config.txt (dbPath and ODBC Data Source name)
            this.loadDbConfig();
            // loadDriver
            this.loadDriver();
            // get username and password for the ODBC from user
            this.getDSSecurity();
            // populate dbURL, username and password
            this.setDbURL( this.ODBCDataSource );
            // connect to db
            this.dbConnect();
            // get db metadata
            this.getMDA();
            // get a list of tables in db
            this.getDBTables();
        // load JDBC driver
        public void loadDriver() {
            try {
                Class.forName( getDriver() );
            } catch (Exception e) {
                System.out.println("Failed to load JDBC/ODBC driver.");
                return;
        // connects to db and create a Connection obj and a Statement obj
        public void dbConnect() {
           try {
                this.con = DriverManager.getConnection (
                    this.dbURL,
                    this.Username,
                    this.Password);
                this.stmt = con.createStatement();
            } catch (Exception e) {
                System.err.println("problems connecting to "+this.dbURL);
        // creates table tblname in db
        public void CreateTable( String tblname ) {
            try {
                String sqlcommand = mergeTblName(sqlCreateTable, tblname);
                this.stmt.execute( sqlcommand );
            catch (SQLException ex) {
                System.err.println("problems with SQL statement sent to "+this.dbURL+
                    ": "+ex.getMessage());
                System.out.println("SQL Command: " + mergeTblName(sqlCreateTable, tblname) );
        // updates db with new record(s) by executing the SQL query sqlstmt
        // and closes db connection
        public void dbUpdate( String sqlstmt ) {
            try {
                // execute SQL commands to create table, insert data
                this.stmt.execute( sqlstmt );
                this.con.close();
            } catch (Exception e) {
                System.err.println("problems with SQL sent to "+this.dbURL+
                    ": "+e.getMessage());
        // list all user tables in the db
        public void listTables() {
            //now dump out the names of the tables in the database
            int count = 0;       
            try {
                System.out.println("Listing db tables ...");
                //this.tables.beforeFirst();
                while ( this.tables.next() ) {
                    count++;
                    System.out.print( "Table-" + count + " -> " + this.tables.getString(1) );
                    System.out.println();
            catch ( SQLException ex ) {
                System.out.println( "problem listing db tables: " + ex.getMessage() );
        // checks whether tbname exist in db as a table
        // this function has to be called after dbConnect
        public boolean tableExists( String tbname ) {
            boolean tbexists = false;
            //get the database metadata
            try {
                dma = con.getMetaData();           
            catch (SQLException ex) {
                System.err.println("database connection: " + ex.getMessage());
            //now dump out the names of the tables in the database
            String[] types = new String[1];
            types[0] = "TABLES"; //set table type mask
            //note the %-sign is a wild card (not '*')
            try {
                tables = dma.getTables(null, null, "%", types);
            catch (SQLException ex) {
                System.err.println("database connection: " + ex.getMessage());
            try {
                while ( tables.next() ) {
                    if ( tbname.equalsIgnoreCase( tables.getString(1) ) ) {
                        tbexists = true;
            catch ( SQLException ex ) {
                System.err.println("database connection: " + ex.getMessage());
            return tbexists;
        // merge tablename using REGEX
        public String mergeTblName( String sqlcommand, String tbname ) {
            String REGEX = "TABLENAME";
            String INPUT = sqlcommand;
            String REPLACE = tbname;
            Pattern p = Pattern.compile(REGEX);
            Matcher m = p.matcher(INPUT); // get a matcher object
            INPUT = m.replaceAll(REPLACE);
            //System.out.println(INPUT);
            return INPUT;
        // merge feildnames specific terms using REGEX
        public String mergeFldName( Message msg ) {
            String sqlcommand;
            sqlcommand = "insert into TABLENAME values" +
                    " ('" + msg.getName() + "', '" + msg.getSurname() + "', " +
                    msg.getComputerType() + ", '" + msg.getComputerNAL() + "', " +
                    msg.getHaveMonitor() + ", '" + msg.getMonitorNAL() + "', '" +
                    msg.getDateOfMsg() + "');";
            sqlcommand = mergeTblName( sqlcommand, CurrentAuditTable );
            return sqlcommand;
        // get users input char
        /**public char getChar() {
            int i = System.in.read();
            while (i != -1) {
              // here's your character
              char c = (char) i;
              i = System.in.read();
            return (char) i;
        // load the config parameters from config.txt
        public void loadDbConfig() {
            // make a file obj pointing to the config file config.txt
            File configFile = new File( this.configFile );
            //...checks on configFile are elided
            StringBuffer contents = new StringBuffer();
            //declared here only to make visible to finally clause
            BufferedReader input = null;
            try {
              //use buffering
              //this implementation reads one line at a time
              input = new BufferedReader( new FileReader(configFile) );
              String line = null; //not declared within while loop
              int count = 0;
              while (( line = input.readLine()) != null){
                //first line in config file is dbPath
                if(count == 0) this.setDbPath( line.trim() );
                //second line in config file is ODBCDataSource
                if(count == 1) this.setODBCDataSource( line.trim() );
                count++; 
                //contents.append(line);
                //contents.append(System.getProperty("line.separator"));
            catch (FileNotFoundException ex) {
                System.err.println("the file congif.txt cannot be found ...");
                System.err.print("Enter the path to db file (e.g. c:\\temp): ");
                BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
                //  read the db path from the command-line; need to use try/catch with the
                //  readLine() method
                try {
                    this.setDbPath( br.readLine() );
                catch (IOException ioe) {
                    System.out.println("IO error trying to read user input.");
                    System.exit(1);
                System.err.print("Enter the name of the ODBC Data Source: ");
                //  read the ODBC Data Source name from the command-line; need to use try/catch with the
                //  readLine() method
                try {
                    this.setODBCDataSource( br.readLine() );
                catch (IOException ioe) {
                    System.out.println("IO error trying to read user input.");
                    System.exit(1);
                ex.printStackTrace();
            catch (IOException ex){
              //ex.printStackTrace();
            finally {
              try {
                if (input!= null) {
                  //flush and close both "input" and its underlying FileReader
                  input.close();
              catch (IOException ex) {
                //ex.printStackTrace();
            //return contents.toString();
        // get datasource security details i.e. username and password
        public void getDSSecurity() {
            // get username
            System.out.print("Enter username for the ODBC DataSource: ");
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            //  read the username from the command-line; need to use try/catch with the
            //  readLine() method
            try {
                this.setUsername( br.readLine() );
            catch (IOException ioe) {
                System.out.println("IO error trying to read username.");
                System.exit(1);
            // get password
            System.out.print("Enter password: ");
            //  read the username from the command-line; need to use try/catch with the
            //  readLine() method
            try {
                this.setPassword( br.readLine() );
            catch (IOException ioe) {
                System.out.println("IO error trying to read password.");
                System.exit(1);
        private void dumpResults(String head)
         //this is a general routine to print out
         //column headers and the contents of each column
         System.out.println(head);
          try
           //get the number of columns from the metadata
           this.rsmd = this.tables.getMetaData();      
           numCols = this.rsmd.getColumnCount();
           //print out the column names
           for (i = 1; i<= numCols; i++)
             System.out.print(rsmd.getColumnName(i)+"     ");
           System.out.println();
           //print out the column contents
           boolean more = this.tables.next();
           while (more)
             for (i = 1; i <= numCols; i++)
               System.out.print(this.tables.getString(i)+"     ");
             System.out.println();
             more = this.tables.next();
         catch(Exception e)
           {System.out.println(e.getMessage());}
        /** Creates a new instance of dbManager */
        public dbManager() {
            this.dbInitialize();
    }here is the result when I make a new dbManager obj from my server class which is a multithreaded one.
    H:\java>java EchoServer
    Enter username for the ODBC DataSource: admin
    Enter password: purina123
    Tables
    TABLE_CAT TABLE_SCHEM TABLE_NAME TABLE_TYPE REMARKS
    Listening for clients on 12111...
    here is the code of my server class called EchoServer:
    import java.net.*;
    import java.io.*;
    public class EchoServer
        ServerSocket m_ServerSocket;
        dbManager haDB;
        public EchoServer() 
            // db methods to setup a jdbc connection to the database
            haDB = new dbManager();
            // list tables
            //haDB.listTables();       
            //haDB.getDBTables();
            // create table
            //haDB.CreateTable("TestTable2");
            // update table
            // server code
            try
                // Create the server socket.
                m_ServerSocket = new ServerSocket(12111);
            catch(IOException ioe)
                System.out.println("Could not create server socket at 12111. Quitting.");
                System.exit(-1);
            System.out.println("Listening for clients on 12111...");
            // Successfully created Server Socket. Now wait for connections.
            int id = 0;
            while(true)
                try
                    // Accept incoming connections.
                    Socket clientSocket = m_ServerSocket.accept();
                    // accept() will block until a client connects to the server.
                    // If execution reaches this point, then it means that a client
                    // socket has been accepted.
                    // For each client, we will start a service thread to
                    // service the client requests. This is to demonstrate a
                    // multithreaded server, although not required for such a
                    // trivial application. Starting a thread also lets our
                    // EchoServer accept multiple connections simultaneously.
                    // Start a service thread
                    ClientServiceThread cliThread = new ClientServiceThread(clientSocket, id++, haDB);
                    cliThread.start();
                catch(IOException ioe)
                    System.out.println("Exception encountered on accept. Ignoring. Stack Trace :");
                    ioe.printStackTrace();
        public static void main (String[] args)
            new EchoServer();    
        class ClientServiceThread extends Thread
            Socket m_clientSocket;        
            int m_clientID = -1;
            dbManager m_db;
            boolean m_bRunThread = true;
            ClientServiceThread(Socket s, int clientID, dbManager db)
                m_clientSocket = s;
                m_clientID = clientID;
                m_db = db;
            public void run()
                // Obtain the input stream and the output stream for the socket
                // A good practice is to encapsulate them with a BufferedReader
                // and a PrintWriter as shown below.
                BufferedReader in = null; 
                PrintWriter out = null;
                Message msg = new Message();
                // Print out details of this connection
                System.out.println("Accepted Client : ID - " + m_clientID + " : Address - " + 
                                 m_clientSocket.getInetAddress().getHostName());
                try
                    in = new BufferedReader(new InputStreamReader(m_clientSocket.getInputStream()));
                    out = new PrintWriter(new OutputStreamWriter(m_clientSocket.getOutputStream()));
                    // At this point, we can read for input and reply with appropriate output.
                    // Run in a loop until m_bRunThread is set to false
                    while(m_bRunThread)
                        // read incoming stream
                        String clientCommand = in.readLine();
                        if ( clientCommand.indexOf(",") != -1 ) {
                            msg.deserialize( clientCommand );
                            System.out.println("SQL command: " + m_db.mergeFldName(msg) );
                            m_db.dbUpdate( m_db.mergeFldName(msg) );
                            //System.out.println("Name :" + msg.getName() );
                            //System.out.println("Surname :" + msg.getSurname() );
                            //System.out.println("ComputerType :" + msg.getComputerType() );
                            //System.out.println("ComputerNAL :" + msg.getComputerNAL() );
                            //System.out.println("HaveMonitor :" + msg.getHaveMonitor() );
                            //System.out.println("Monitor NAL :" + msg.getMonitorNAL() );
                            //System.out.println("AuditDate :" + msg.getDateOfMsg() );                       
                        System.out.println("Client Says :" + clientCommand);
                        if(clientCommand.equalsIgnoreCase("quit"))
                            // Special command. Quit this thread
                            m_bRunThread = false;   
                            System.out.print("Stopping client thread for client : " + m_clientID);
                        else
                            // Echo it back to the client.
                            out.println(clientCommand);
                            out.flush();
                catch(Exception e)
                    e.printStackTrace();
                finally
                    // Clean up
                    try
                        in.close();
                        out.close();
                        m_clientSocket.close();
                        System.out.println("...Stopped");
                    catch(IOException ioe)
                        ioe.printStackTrace();
    }

    I find that taking any problem and reducing it to the simplest thing is the best way to approach it.
    Why you had to post all that bloody code (especially since you didn't write it) is beyond me.
    This will list all the tables in an Access database (or any other, for that matter):
    import java.sql.Connection;
    import java.sql.DatabaseMetaData;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.ResultSetMetaData;
    import java.sql.SQLException;
    import java.util.ArrayList;
    import java.util.List;
    import org.jdom.Element;
    import org.jdom.Document;
    import org.jdom.output.XMLOutputter;
    public class TableLister
        public static final String DRIVER   = "sun.jdbc.odbc.JdbcOdbcDriver";
        public static final String DATABASE = "jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb)};DBQ=c:\\Edu\\Java\\Forum\\DataConnection.mdb";
        public static final String USERNAME = "admin";
        public static final String PASSWORD = "";
        public static void main(String [] args)
            try
                String driver           = ((args.length > 0) ? args[0] : DRIVER);
                String url              = ((args.length > 1) ? args[1] : DATABASE);
                String username         = ((args.length > 2) ? args[2] : USERNAME);
                String password         = ((args.length > 3) ? args[3] : PASSWORD);
                Class.forName(driver);
                Connection conn         = DriverManager.getConnection(url, username, password);
                DatabaseMetaData meta   = conn.getMetaData();
                // Bring back ALL tables and views, including SYSTEM tables.
                ResultSet tables        = meta.getTables(null, null, null, null);
                ResultSetMetaData rsmd  = tables.getMetaData();
                int numColumns          = rsmd.getColumnCount();
                List columnNames        = new ArrayList();
                for (int j = 0; j < numColumns; ++j)
                    columnNames.add(rsmd.getColumnName(j+1));
                Element root = new Element("tables");
                int tableCount = 0;
                while (tables.next())
                    Element table = new Element("table");
                    table.setAttribute("id", Integer.toString(++tableCount));
                    for (int j = 0; j < numColumns; ++j)
                        Element column = new Element((String)columnNames.get(j));
                        column.setText(tables.getString((String)columnNames.get(j)));
                        table.addContent(column);
                    root.addContent(table);
                conn.close();
                Document doc = new Document(root);
                XMLOutputter outputter = new XMLOutputter("   ", true);
                System.out.println(outputter.outputString(doc));
            catch (ClassNotFoundException e)
                System.err.println("Couldn't load JDBC driver class");
                e.printStackTrace();
            catch (SQLException e)
                System.err.println("SQL state: " + e.getSQLState());
                System.err.println("SQL error: " + e.getErrorCode());
                e.printStackTrace();
            catch (Exception e)
                e.printStackTrace();
    }Run it and see if it works for you. If it does, put the essence of the code into your stuff.
    %

Maybe you are looking for