ACE Cookie insert behavior

Hi ,
My requirement is as follows
i have following url
http://x.x.x.x/abc
http://x.x.x./dce
http://x.x.x.x/fgh
only for http://x.x.x.x/abc should be using stickiness based on http cookie insert remaining all it should use ip based stickiness.
problem what i am facing is ,
if i access http://x.x.x.x/dce , it is not showing any COOKIE in the header ( which is as expected ) and when i access http://x.x.x./abc it showing the inserted COOKIE (again expected) , but when i am accessing the url http://x.x.x.x/dce or fgh again , it is still showing the INSERTED COOKIE  is it a known behaviour?.
as far as i understand , before the session  request , ACE maintains the insert cookie values in the cookie database and thus it is less processing intensive.
However , why is it inserting to all request , even though i am not configuring as such .
following is my configuration  , is it a known behaviour or is it the way it should work?
serverfarm host SF-FOR-DCE
  probe TCP_8032
  rserver MYSERVER1 8032
    inservice
  rserver MYSERVER2 8032
    inservice
serverfarm host SF-FOR-FGH
  probe TCP_8083
  rserver MYSERVER1 8083
    inservice
  rserver MYSERVER2  8083
    inservice
serverfarm host SF-FOR-ABC
  probe TCP_8081
  rserver MYSERVER1 8081
    inservice
  rserver MYSERVER1 8081
    inservice
sticky http-cookie COOKIE-SKYCHAIN STICKY-ABC
  cookie insert browser-expire
  timeout 720
  replicate sticky
  serverfarm SF-FOR-ABC
sticky ip-netmask 255.255.255.0 address source STICKY-DCE
  timeout 720
  replicate sticky
  serverfarm SF-FOR-DCE
sticky ip-netmask 255.255.255.0 address source STICKY-EFG
  timeout 720
  replicate sticky
  serverfarmSF-FOR-FGH
class-map type http loadbalance match-all CM7-1
  2 match http url /dce/*.*
class-map type http loadbalance match-all CM7-2
  2 match http url /fgh/*.*
class-map type http loadbalance match-all CM7-3
  2 match http url /abc*.*
policy-map type loadbalance first-match PM7-1
  class CM7-1
    sticky-serverfarm STICKY-DCE
  class CM7-2
    sticky-serverfarm STICKY-EFG
  class CM7-3
    sticky-serverfarm STICKY-ABC
class-map match-any CM3-VIP
  3 match virtual-address x.x.x.x tcp eq www
policy-map multi-match PM34-VIP
class CM3-VIP
    loadbalance vip inservice
    loadbalance policy PM7-1
    loadbalance vip icmp-reply
Assistance appreciated.
thanks
-PMD

Are you seeing the client still send the cookie when going to the other locations /DCE or /FGH, or are you seeing the ACE insert the cookie? If you are only seeing the client still sending the cookie this is expected behavior. The cookie is issued for the path / so if the client learned the cookie from the domain x.x.x.x it will send the cookie any time it goes to that domain regardless of the path that is being used.
Regards
Jim

Similar Messages

  • ACE cookie-insert stickyness

    Hi, I am trying to understand the ACE`s cookie-insert method of stickiness. So the ACE will always insert a cookie into the http-header when sending a response to the client/browser. Based on that if it recieves the same cookie-id in the subsequent requests it knows to which end-server to send it as it does an internal hash based on the cookie-value.
    My question is, what happens if the server also sends a cookie? Does ACE dis-regards that cookie and inserts a new one on it`s own? How do the cookie-insertion from the server (which is done by default by the web-servers) co-exist with the cookie insertion by the ACE?
    thnx

    Hi,
    As long as they don't both use the Same Cookie name they won't influence each other.
    If you don't assign a cookie-name ACE will create a unique one per rserver.
    Or you can configure one e.g.
    rserver WebServer1 80
        cookie-string "ACEWS1Cookie"
    More details can be found here:
    http://www.cisco.com/en/US/customer/docs/app_ntwk_services/data_center_app_services/ace_appliances/vA3_1_0/configuration/slb/guide/sticky.html

  • ACE: new stiky cookie inserted for different URL?

    I have sticky cookies set (cookie insert) and http persistence rebalance on. The virtual server is made of a group of three real http servers.
    The DNS name of the virtual server is for example "vhost.domain.com".
    If I browse (from the internal network) to "http://vhost/" my session is stuck to a real server using cookie stickiness. My question is, when I click a link which is fully qualified e.g. "http://vhost.domain.com/newpage.html" is a stickiness maintained or as the http header has changed is it seen as a new session and potentially sending me to a different real server?

    ACE doesn't care about the url.
    It will simply look for the presence of the cookie.
    If the cookie is there, you will stick to the same rserver.
    If not, this is considered a new connection and the request is loadbalanced.
    So, it all depends if your browser consider that vhost and vhost.domain.com are the same because the cookie is associated to a domain.
    Normally it should consider them the same.
    Gilles.

  • ACE Cookie Persistence

    Hi All,
    I have an issue on the ACE that is doing SSL offload to a server farm and using cookies for stickyness.
    The issue is I am trying to establish what value i need to enter when trying to dynamically learn cookies in the server response?
    I understand that cookie insertion is an option but is not currently being used.
    I have checked the syntax
    sticky http-cookiename1 name2
    Where name1 is the value that needs to be matched, how do i find out this value?
    Your help would be much appreciated.
    Kris

    Kris,
    that a sniffer trace of the traffic going to the server.
    Then check the server response for a line which looks like : set-cookie:  name=value.
    This means the server will always use the cookie "name" and a different "Value" for each client.
    So you configure ACE to look for hte "name" and it will learn the "value" automatically.
    If you really do not understand http cookies, you could simply use the "sticky cookie insert" feature.
    ACE will do everything for you automatically.
    Gilles.

  • ACE cookie-based slb

    Hi,
    I'm trying to configure a cookie-based slb method which corresponds to my current CSS11503-configuration. Basicly, my CSS performs slb purely based on the content of the arrowpoint-cookie, using the following config:
    advanced-balance arrowpoint-cookie
    arrowpoint-cookie name WPS6
    The cookie contains the real ip of the underlying webserver and the CSS fowards traffic based on that particular content of the cookie. Whenever we need to do an unscheduled shutdown of a webserver, we gracefully take the webserver out of service by setting the weight to 0, but also, my webdepartment have implemented a feature in Websphere, that somehow sends a cookie-expire to both the SESSIONID-cookie and the WPS6 cookie. So once the subsequent http-req hits the CSS, the cookie is gone and the CSS lb'es the req to a diffent server. We've intentionally left out the sticky-option, as it didn't work well with the before mentioned Websphere-feature.
    Now I'm trying to configure something similar on the ACE, but so far without luck. I did start by configuring sticky-group with the cookie-insert option and a http-parametermap with persistence-rebalance. But all attempts to recreate the above mentioned scenario, have failed. It's seems, that even with persistence-rebalance, the client-session is still stuck to the webserver and a display of the sticky-database shows, that the sticky-entry persists. Even when I manually delete the cookie-container on the client and verify with the Live-HTTP-plugin, that the subsequent http-req does not contain the WPS6 cookie, the req is still forwarded to the realserver. Even when the real-server is placed in 'inservice standby'.
    Is it possible to staticly define a cookie-value for, say, 4 webservers, each with their own unique cookie? And when the initial part of the tcp is completed and the ACE decides which realserver is to be used, it sets a cookie containing that particular value and includes it in the http-response. So if any subsequent http-req's are not containing that cookie, the ACE re-balancences that req and sends it to a different webserver.
    /Ulrich
    PS! Merry X-mas

    Ulrich,
    what you're asking for is what ACE does currently.
    The static cookies are created at configuration time.
    You can see the values with "show sticky cookie-insert"
    ie:
    switch/Admin# show sticky cookie-insert group portalap
         Cookie   |        HashKey       |           rserver-instance
      ------------+----------------------+----------------------------------------+
      R4181073320 | 11105909834649097754 | vmware-http/vmware-27:80
      R4181109257 | 10017312105356339124 | vmware-http/vmware-28:80
      R4183409225 | 15537882249682767338 | vmware-http/vmware-46:80
      R4183517036 | 1787657754489574767  | vmware-http/vmware-49:80
    Whenever we see the cookie "R...." we check if the associated server is alive and forward the connection to that server.
    Otherwise we loadbalance to a new server and include the new cookie in the response.
    For established connections, persistence rebalance is indeed required to inspect every request and rebalance the connection to a new server if a new cookie is detected.  However ACE will try not to rebalance when not needed.
    If you need a new loadbalancing decision each time, you need 'persistence rebalance strict'.
    An alternative could be the configuration of 'failaction purge' to force the connection to be terminated when the server goes down.
    'inservice standby' is described @ http://www.cisco.com/en/US/docs/app_ntwk_services/data_center_app_services/ace_appliances/vA3_1_0/configuration/slb/guide/rsfarms.html#wp1000333
    •Tears down existing non-TCP connections to the server
    •Allows current TCP connections to complete
    •Allows new sticky connections for existing server connections that match entries in the sticky database
    •Load balances all new connections (other than the matching sticky connections mentioned above) to the other servers in the server farm
    •Eventually takes the server out of service
    As you can see, this option still allows connection to the server if it matches a sticky entry.
    Gilles.

  • ACE cookie stickiness

    Is there a way for the ACE to read the cookie value if it has a period in it (.).  For example the cookie is ASP.NET_SessionID.  The ACE appears to be ignoring the (.).  I know I can switch to cookie insert, but was curious if I can work with the (.) in case this comes up in the future.

    Is there a way for the ACE to read the cookie value if it has a period in it (.).  For example the cookie is ASP.NET_SessionID.  The ACE appears to be ignoring the (.).  I know I can switch to cookie insert, but was curious if I can work with the (.) in case this comes up in the future.

  • ACE cookie stickiness issue

    Hi,
    We are having ACE as the load balancer
    Software running on ACE
    loader: Version 12.2[121]
    system: Version A2(1.1a) [build 3.0(0)A2(1.1a) adbuild_22:19:41-2008/07/21_
    /auto/adbu-rel3/rel_a2_1_1_throttle/REL_3_0_0_A2_1_1A]
    system image file: [LCP] disk0:c6ace-t1k9-mz.A2_1_1a.bin
    We have 2 webservers (load balanced) & 2 application servers(load balanced).Cookie based stickiness is currently used on Web & Application servers.
    Ideal scenario:
    1.Client opens the url http://...There is always a dual session whenever the client opens the url.One is for Java & the other for html.
    2.Client--->Webserver1
    3.Webserver1---->APP1
    Most of the times when the client types the url, the dual sessions goes to one Webserver as per round robin (eg web server 1) & the webserver 1 communicates with Application server as per round robin (eg.application server 1).
    Problem:
    Now at times when the client types the url, the dual sessions gets split which means one session goes to one webserver & the other session goes to second webserver.Ideally it should not as per the application demands.
    When this happens, both the webservers communicates with both the application servers.Here is where the problem happens.The client is asked for the login page again which indicates that the client has went to the second application server for the login.
    What ideally should happen is the client should stick to the same application server depending up the sticky timeout.
    Foll. is the output of show conns when prob occurs:
    Primary-ACE/DMZ2# sh conn serverfarm SF-8888
    conn-id np dir proto vlan source destination state
    ----------+--+---+-----+----+---------------------+---------------------+------+
    1321 1 in TCP 2504 172.21.46.34:2037 172.24.51.200:8888 ESTAB
    1255 1 out TCP 2704 172.24.51.33:8888 172.21.46.34:2037 ESTAB
    1108 2 in TCP 2504 172.21.46.34:2036 172.24.51.200:8888 ESTAB
    1144 2 out TCP 2704 172.24.51.32:8888 172.21.46.34:2036 ESTAB
    Primary-ACE/APP# sh conn serverfarm SF-8888
    conn-id np dir proto vlan source destination state
    ----------+--+---+-----+----+---------------------+---------------------+------+
    959 2 in TCP 2507 172.24.51.32:58306 172.24.54.200:8888 ESTAB
    115 2 out TCP 2707 172.24.54.32:8888 172.24.51.32:58306 ESTAB
    651 2 in TCP 2507 172.24.51.33:51030 172.24.54.200:8888 ESTAB
    901 2 out TCP 2707 172.24.54.33:8888 172.24.51.33:51030 ESTAB
    I have attached the configs.
    The web server we are testing is 172.24.51.32 & 33 - port 8888
    Application servers - 172.24.54.32 & 33-port 8888
    Rgds./Sachin

    Sachin~
    What is exactly your flow?
    Is client hitting the Webserver farm (in web server context) and then Web servers hitting the APPs Servers in the APPS server context?
    If thats the case (only Web servers are App server clients and client is not hitting application serverfarm ) then you can use source ip based sticky in APP server farm which will ensure that one web server sticks to a particular APP server and it never changes the APP server.
    Following example will insert cookie named "Mycookie" in the server responses from APP1 rservers to the client
    rserver host App1-Srvr1
    ip address 192.168.1.1
    inservice
    rserver host App1-Srvr2
    ip address 192.168.1.2
    inservice
    serverfarm host APP1-SFARM
    rserver App1-Srvr1
    inservice
    rserver App1-Srvr2
    inservice
    class-map match-any APP1-VIP
    2 match virtual-address 10.10.10.1 tcp eq www
    sticky http-cookie MYcookie App1-sticky
    cookie insert
    timeout 720
    replicate sticky
    serverfarm App1-Sfarm
    policy-map type loadbalance first-match APP1-POLICY
    class class-default
    sticky-serverfarm App1-sticky
    policy-map multi-match VIPS
    class VIP-P80
    loadbalance vip inservice
    loadbalance policy APP1-POLICY
    loadbalance vip icmp-reply active
    HTH
    Syed Iftekhar Ahmed

  • CSS cookie insertion

    Hi everyone,
    I have a question about the cookie insertion.
    I understand there are two method of inserting cookie,
    1: by Server
    2: by CSS
    and those method can not be configured simultaneously, that is, if the cookie inserted by server,
    CSS can not insert the cookie for the connection.
    Because if the cookie inserted by server and by CSS, the server can not accept the cookie
    information.
    For example,
    Server inserts the cookie "0123456789"
    and also
    CSS inserts the cookie "ARPT=bbbbbbbsssssttttttt"
    Server expects the cookie information is "0123456789" but the cookie information reaches
    to the server is "ARPT=bbbbbbbsssssttttttt;0123456789".
    So the server can not recognize the HTTP connection includes the cookie "ARPT=bbbbbbbsssssttttttt;0123456789"
    because the server only understands the cookie "0123456789".
    Does my understand is true ?
    Or in this situation, does CSS remove the own inserted cookie (ARPT...) by understanding that
    "the server also inserts cookie so I (CSS) need to remove cookie" ?
    Your information would be greatly appreciated.
    Best regards,

    just use a different cookie name on the server.
    ARPT is the one by default on the CSS and it stands for ARrowPoinT.
    If your server uses a different cookie name like SERVER, then both cookie can exist at the same time.
    The client would received
    ARPT=bbbbbbbsssssttttttt
    SERVER=0123456789
    and it will also send this data when sending the next request.
    The CSS will detect the ARPT=... value and use it and then pass all the data to the server.
    The server will also see its own cookie SERVER=.....
    Gilles.

  • PWA 2013 "Add a new task" - inconsistent task insertion behavior

    Hi all!
    New to the forum and wondering if anyone out there has insight into what I've encountered with the "Add a new task" feature in on-prem Project Server 2013.  
    First some context... I am setting up 12-month projects for different teams to forecast and log their administrative and reactive time for the year.
     We are tracking this within enterprise projects.  The projects have a series of summary tasks that serve to categorize work.  There is a placeholder task within each summary task that establishes duration and where we may assign generic resources
    to establish a baseline cost for the 12 month period for that category of work.  The vision is for team members to go to their PWA Tasks list, "Add a new task", select the project and the summary task to categorize and add their new task to
    the project, enter the task information, and submit for approval.  
    My issue appears when the Project Manager approves a task and opens the project in Project Professional because the system appears to exhibit inconsistent
    behavior - Scenario 1 vs Scenario 2 below.  
    Scenario 1 – Project structure prior
    to adding a new task:
    Project Summary Task, 260d
    -Summary Task, 260d
    --Placeholder Task, 260d, generic resources assigned, ID=n
    -Summary Task, 260d
    Team member adds a new task and submits.  The new task is inserted as a child task to the summary task selected when adding
    the new task.  This is what PWA Approval Preview shows and what is found when file is opened in Project Professional:
    Project Summary Task, 260d?
    -Summary Task, 260d?
    --New task just added, 2d?, named resource assigned, ID=n
    --Placeholder Task, 260d, generic resources assigned, ID=n+1
    -Summary Task, 260d
    Scenario 2 – Same project structure as scenario 1... team member submits a new task
    and the new task is inserted per below.  This is NOT what PWA Approval Preview shows.  PWA shows the new task as a child of the summary task.  Once approved and the file is opened in Project Professional, the task instead reflects as a child
    task to the placeholder task, and impacts the duration of the original summary task:
    Project Summary Task, 260d?
    -Summary Task, 2d?
    --Placeholder Task, 2d?, generic resource assignments, ID=n
    ---New task just added, 2d?, named resource assigned, ID=n+1
    -Summary Task, 260d
    I am using separate project files to produce the scenario, and as far as I can tell they are set up exactly the same, but one file consistently produces
    scenario 2 behavior and the other consistently produces scenario 1 behavior. It seems that something is different between the two files and causing the issue, but I can't figure out what it is.  
    Any idea what I could do to establish consistent (preferably Scenario 1) task insertion behavior from PWA?

    Anyone else running into this?  We're now on the April CU and still experiencing this apparent bug.  I've replicated it in different PWA instances using "Add a new task" from both the timesheet and tasks.  
    It only happens on certain projects as Greg mentioned... One way we've been able to pinpoint where it's taking place:  since the bug causes a task to become a summary task, and since most of our tasks have assignments, if a project contains any summary
    tasks with assignments, those may be an early indicator of the bug (after we rule out PM-induced summary task assignments).  
    We're seeing this impact our project actuals and reports, so there is a fair amount of going back through approval history and restoring actual hours to the correct calendar dates in the Project Client.  Not ideal, because we are planning to lock that
    capability down in the near future.
    On a whim, I tried using the "Save for sharing" method to fix the issue, and new tasks appeared to insert correctly after that.  Seems OK for a workaround (we'll see how durable it is), but better yet would be consistent new task insertion
    behavior.

  • Cookie insert in the CSM module

    Hello
    I would like to ask if anbody know why when I use the "cookie insert" option in the CSM configuration with the timeout of 60 minutes, from the browser point of view the cookie expires in 2010? I have checked in on the CSM and CSM-S and in both of them it works the same way.
    Thanks in advance
    Regards
    Lukas

    Its because of the variable (COOKIE_INSERT_EXPIRATION_DATE) that sets the expiry date to Jan 2010. Use "show mod csm X
    variable" to see it.
    xyz#sh mod csm 3 var | include EXPIRATION
    COOKIE_INSERT_EXPIRATION_DATE Fri, 1 Jan 2010 01:01:50 GMT
    Setting this variable to none makes it a session cookie ( expire at
    the end of the session -- cookie will be erased when the browser is closed).
    (config-module-csm)#variable COOKIE_INSERT_EXPIRATION_DATE ""
    With "cookie insert feature" on the CSM ,
    the timeout value configured in the sticky has no affect. You will always see a timeout of zero.
    Syed Iftekhar Ahmed

  • An interesting problem with DW insert behavior

    I've recently realized that the Insert behavior allows for
    certain
    problems.. for example,
    http://www.websitenamehere.com/register.asp?MM_Insert=Registration
    will insert a null record since the querystring MM_Insert
    having the Value
    of Registration will set up all the conditions necessary to
    insert a record
    without validating any data.
    I know this because I recently had 200 null records suddenly
    show up in the
    database.. any suggestions for how to avoid this? Anyone?

    We have done a lot in the field of xsl:fo but not for BIP but for FOP. I've had the same problem for some reports but in the end I gave up and used jasperserver. I find it a little amusing that the same problem of FOP exists in BIP...
    Jasper reports is completely java based and can convert to all formats BIP can. It can also read html from clobs and convert it for your reports.
    Another advantage is that it's free. The downside is that imho there are still some bugs in the jasperserver and it's quit hard to install. But once it's running it's great...
    Br,
    Nico
    Edited by: NicoMartens_InterAccessBE on 16-mei-2011 14:51

  • CSM Sticky Cookie Insert

    Hello,
    We have a Catalyst 6500 w/ CSM-S configuration that has 2 serverfarms with identical real servers using the same VIP. Each farm has 50 real servers (2 IPs with 25 consecutive ports each). One of the serverfarms is defined under a SLB policy with client NAT and the second one directly under the vserver. Both serverfarms are configured with the same sticky group for cookie insert. When I issue "show mod csm 13 sticky group 4" I only see 52 entries instead of 100. Also, some of the entries are duplicate. All the rest of the sticky groups are displaying the correct number of cookie entries, matching the number of real servers in the farms. Any ideas on why this is?

    You probably have encountered the following bug fixed only in version 4.2.2
    CSCsa74493
    CSM: sticky insert table not updated if adding new reals
    The workaround is to reboot the CSM or reconfigure reals, policy and vserver in the correct order.
    Gilles.

  • Doing an insert behavior in Dreamweaver CS five and Access?

    so there I am doing  an Insert Record into a table  in Access. I have used this behavior before and have had no problem. When I am doing a form element type selection (for each field in the record) I have no problem – except for the second field. The default value <ignore >cannot be changed: there is no drop-down list as there is with every other field. I have tried changing the name of the field (from Fullname to Fname) thinking that this might be a reserved word problem, but it is not. What could be the problem and what might be the solution?
    Thanks!
    Ross

    I've attached a screenshot might depict my dilemma a little more thoroughly: about a picture being worth 1000 words? With this I double clicked on the insert behavior. Notice the "insert into column" drop box which has the phrase <ignore > highlighted?I want to have  fname inserts into fullname but I cannot do so. I have tried changing the field name in the  Access database itself but it makes no difference. I have even tried setting it to a bogus value – one on the list – but I get complaints at runtime about the same input field be stuffed into two columns. So how do I get the actual field name for the column, Fullname, instead of the <ignore >??
    Ross

  • Cookie Insert-Based Persistence

    Hi,
    I'm slightly confused by the relationship between the various timers with relation to cookies.
    For example, I want to use the "cookie insert" feature to provide persistence, but only across sessions. To do this I think I need to modify the COOKIE_INSERT_EXPIRATION_DATE variable to set it to null.
    So far so good.
    1) do I need to do anything more (like match cookie) to enable this persistence? or does it happen automatically?
    2) if I do this what effect does the timer values have on persistence? (i.e. there is a default timeout of 1440 minutes - does this get ignored?)
    thanks,
    Ray.

    setting COOKIE_INSERT_EXPIRATION_DATE to null makes "inserted cookie" session based cookie.
    You just need to
    1. Define a sticky group with insert cookie
    sticky 19 cookie APP1-cookie insert timeout 30
    (timeout defined here has no significance, CSM will insert cookie "APP1-cookie" in the server responses.Cookie values will be different for all the reals)
    2. And Assign it to a VServer/ policy
    vserver APP1-VS
    virtual 10.10.10.12 tcp www
    serverfarm APP1-SF
    sticky 30 group 19
    replicate csrp sticky
    replicate csrp connection
    persistent rebalance
    inservice
    Syed Iftekhar Ahmed

  • BLOB insert behavior with thin driver using standard JDBC2.0 and ORACLE-JDBC2.0API

    We have a problem with a BLOB insert to an oracle 8.1.7 DB using Oracle 8.1.7 JDBC thin driver.We get socket read/write error after inserting 32k of data using the standard JDBC2.0 API but using the Oracle JDBC2.0API (using OracleResultSet) it goes fine. We have a requirement to use the standard JDBC2.0 so that our code works with multiple database vendors. Is there another way to get in the blob data with standard JDBC API & using thin driver...?
    thanks,
    Madhu
    Here is my sample test program that does both standard & oracle specific JDBC Blob test insert.
    import java.sql.*;
    import java.io.*;
    import oracle.sql.BLOB;
    import oracle.jdbc.driver.OracleResultSet;
    public class testBLOB {
    //trying to insert a huge file to a BLOB
    static String fileName = "/kernel/genunix";
    public static void main(String[] args) {
    String driverName = "oracle.jdbc.driver.OracleDriver";
    String dbURL = "jdbc:oracle:thin:@localhost:1521:test"; //thin driver
    String user = "BlobTest";
    String passwd = "BlobTest";
    Connection con=null;
    try {
    Class.forName(driverName);
    con=DriverManager.getConnection(dbURL, user,passwd);
    catch (Exception e) {
    e.printStackTrace();
    close(con);
    int i = 0;
    while (i < args.length) {
    if (args.equals("-f"))
    fileName = args[++i];
    i++;
    System.out.println("The file being Stored is: "+fileName);
    createTable(con);
    insertUsingOracleAPI(con);
    insertUsingJDBC20API(con);
    //readDB(con);
    static String getFileName() {
    return fileName;
    public static void close(Connection con) {
    try {
    if (con != null) {
    con.close();
    catch (Exception e) {
    System.exit(-1);
    public static void createTable(Connection con) {
    Statement stmt ;
    try {
    stmt = con.createStatement();
    stmt.execute("DROP TABLE basic_blob_table");
    stmt.close();
    catch (SQLException sqlEx) {
    System.out.println("Dropped the Table");
    try {
    stmt = con.createStatement();
    stmt.execute("CREATE TABLE basic_blob_table ( x varchar2(30), b blob)");
    stmt.close();
    catch (SQLException sqlEx) {
    sqlEx.printStackTrace();
    close(con);
    System.out.println("Created the Table");
    public static void insertUsingOracleAPI(Connection con) {
    OutputStream os = null;
    Statement stmt = null;
    ResultSet rs = null;
    FileInputStream is = null;
    try {
    con.setAutoCommit(false);
    stmt = con.createStatement();
    stmt.execute("INSERT INTO basic_blob_table VALUES( 'OracleAPI', empty_blob())");
    System.out.println("Inserted the dummy Row");
    rs = stmt.executeQuery("Select * from basic_blob_table where x='OracleAPI'");
    if (rs != null && rs.next()) {
    BLOB blob = ((OracleResultSet)rs).getBLOB(2);
    File file = new File(getFileName());
    is = new FileInputStream(file);
    os = blob.getBinaryOutputStream();
    byte[] chunk = new byte[1024];
    int length = -1;
    while((length = is.read(chunk)) != -1)
    os.write(chunk, 0,length);
    System.out.println("Inserted the File " + getFileName() );
    catch (Exception e) {
    e.printStackTrace();
    finally {
    try {
    if (os != null) {
    os.flush();
    os.close();
    if (is != null)
    is.close();
    stmt.close();
    con.commit();
    con.setAutoCommit(true);
    catch (Exception e) {}
    public static void insertUsingJDBC20API(Connection con) {
    PreparedStatement stmt = null;
    FileInputStream is = null;
    try {
    stmt = con.prepareStatement("INSERT INTO basic_blob_table VALUES(?,?)");
    File file = new File(getFileName());
    is = new FileInputStream(file);
    stmt.setString(1,"JDBC20API");
    stmt.setBinaryStream(2,is,(int)file.length());
    stmt.executeUpdate();
    catch (Exception e) {
    e.printStackTrace();
    finally {
    try {
    if (is != null)
    is.close();
    stmt.close();
    catch (Exception e) {}
    null

    Thanks for the response.
    I understand what you are saying...
    that readers don't block writers in Oracle (the same is true in SQL Server 2000).
    However, I don't see how my test case is working correctly with Oracle (the exact same code acting as I'm thinking it should with SQL Server, but I still think it is acting incorrectly with Oracle).
    I have transaction A do this:
    update <table> set <column2>=<value> where <column1>='1'
    then I use Thread.sleep() to make that program hang around for a few minutes.
    Meanwhile I sneak off and start another program which begins transaction B. I have transaction B do this:
    select * from <table> where <column1>='1'
    and the read works immediately (no blocking... just as you have said) however, transaction A is still sleeping, it has not called commit() or rollback() yet.
    So what if transaction A were to call rollback(), the value read by transaction B would be incorrect wouldn't it ?
    Both A and B use setAutoCommit(false) to start their transactions, and then call setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED).
    Isn't that supposed to guarantee that a reader can only read what is committed ?
    And if a row is in "flux"... in the process of having one or more values changed, then the database cannot say what the value will be ?
    I can almost see what you are saying.
    In letting the reader have what it wants without making it wait, I suppose it could be said that Oracle is holding true to the "only let committed data be read"
    So if that's it, then what if I want the blocking ?
    I want an entire row to be locked until whoever it in the middle of updating, adding, or removing it has finished.
    Do you know if that can be done with Oracle ? And how ?
    Thanks again for helping me.

Maybe you are looking for

  • Bank Branch upload through open interface Table

    Hello All, I am currently doing Bank and Branch Conversion. My question is , is there any Open Interface Table available for bank and branch upload although there is api available .Please let know if any interface table and seeded program is availabl

  • Problem with trnsaction variant

    Hi Gurus, I want to create transaction variant for XD01 transaction and make district field mandatory. I have done it using transaction SHD0 and its showing effects when i test it from SHD0. But I cant see its effect in actual transaction XD01. Pleas

  • How do I set up printer to air print from the iPad

    how do I set up my hp deskjet 3054 to air print?

  • Lock entries appearing again after deleting

    Hi, I am deleting some old lock entries in SM12 but i dont know how , deleted entries are appearing again back. Can you please suggest how to tackle this problem. Thanks

  • Drill-down in protected sheet

    Dear Expert, I have a report in a protected sheet to prevent users from modifying formulas etc., The problem is when I try to do drill-down it doesn't allow me. Is there any workaround to that? Thanks in advance. Regards, Enric Munné