Table locking in MS SQL Server

Hi
Can anyone help with a locking problem I have. I have a jsp accessing an MS SQL 7 table. The data access has exception handling and the connection and resultset are closed within the finally block, however the table accessed sometimes gets locked preventing any updates to the records. I am using web logics jdbc driver.
Any help would be appreciated.
Dave

A quite wide issue.
Firstly, if you don't do locks, you may experince the locks other connections (by other programs) have caused.
If you do your connection with setTarnsactionIsolation( Connection.READ_UNCOMMITTED ), then you should not be influenced by other's locks. But this level is not to be recommended.
The default is Connection.READ_COMMITTED. In this level - and the higher levels as well - you are prevented from even reading a value which another connection has written, but not yet committed.
Much more locking influences, if you want to do an update.
Now, from the transaction logic only that row that is touched would have to be locked. But SQLServer has a kind of "self-deciding" locking behaviour. It starts with row locks, but if certain internal DBMS resources come low, it switches to using page locks and finally even table locks.
MS claims this as an advantage, my impression. If it is, decide on your own.
This is all described quite largely in the SQLServer docs.
We had some large discussions on this here, too. Search for "+lock +sqlserver" to find them.

Similar Messages

  • Does Create as table command  works in sql server

    Hi friends,
    does Create as table command works in sql server,if yes pls help me with syntax

    > does Create as table command works in sql server,if
    yes pls help me with syntax
    Just out of interest, what is it supposed to do? There is no "CREATE AS TABLE" command in Oracle.

  • SSMA for migrating table from oracle to Sql server

    Hi All,
    I wanted to replicate oracle huge table to sql server and i am using SSMA.its helpful and fast but can we replicate the table to different name using SSMA.for example i have a table TEST and i wanted to replicate it to SQL_TEST.Can it be possible
    using SSMA.
    Kindly help me out 

    Hi All,
    I wanted to replicate oracle huge table to sql server and i am using SSMA.its helpful and fast but can we replicate the table to different name using SSMA.for example i have a table TEST and i wanted to replicate it to SQL_TEST.Can it be possible
    using SSMA.
    Kindly help me out 
    Hello,
    Same question has  already been asked by you in below thead. Why you created duplicate thread ?  please avoid this practice or your thread will be marked ass Spam
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/abcdfb1b-c617-453f-828d-c8e4ec266c78/ssma-for-migrating-table-from-oracle-to-sql-server?forum=sqlintegrationservices
    Moderators plz merge this thread.
    Please mark this reply as the answer or vote as helpful, as appropriate, to make it useful for other readers

  • The user id "sa" is getting locked frequently in SQL server 2008 R2

    Hi Team, 
    We have SQL server 2008 R2 machine and recently i'm getting issue with the user id "sa" as its getting locked out. I;m not sure with the reason caused with this. I need to login to the SQLserver with windows authentication and manually unlock
    the "sa" account and its happening frequently.
    Let me know how to fix this?
    Regards,
    Guru 

    Might be the SA account either using by any application team or any job have been configured to use it, since you are saying that its getting locked out then it someone or application or apps jobs performing with Mulitple incorrect login attempts with incorrect
    password try(since if check_expiration enabled it it can lockout based on the windows password policy, so you can check in the SQL errorlog when was the last login succeeded and from when the incorrect attempts tried & finally it gets locked out(so here
    you will have from which host it was trying)).
    So talk to the application team, did anyone recently changed the SA password or some one misusing or configured to any applications .
    If nothing works then perform the  SQL server side trace to track it or trigger can help
    Thanks, Rama Udaya.K (http://rama38udaya.wordpress.com) ---------------------------------------- Please remember to mark the replies as answers if they help and UN-mark them if they provide no help,Vote if they gives you information.

  • How to share and Access DB (.accdb) with global tables that link to SQL Server tables without having to define ODBC connections on each client PC?

    I have an Access DB with quite a few Linked Tables that point to a SQL Server backend db.  Currently I am using an ODBC connection defined on my pc, but I want other users to be able to download the .accdb file from a share and run.  Will I have
    to define this odbc connection on each client's pc?  Is there a better way to do this without having to have each client manually set this up on their PC?

    I have an Access DB with quite a few Linked Tables that point to a SQL Server backend db.  Currently I am using an ODBC connection defined on my pc, but I want other users to be able to download the .accdb file from a share and run.  Will
    I have to define this odbc connection on each client's pc?  Is there a better way to do this without having to have each client manually set this up on their PC?
    Hi Jason,
    I think you can automate that process. In each application I use a one-record-table in the FE with a field Connected. Connected is default False.
    Starting a database in the development mode ignores this flag. Starting a database in production mode starts, if Not Connected, a procedure to RefreshLink the tables to the BE, and makes Connected = TRUE, so a next startup does not
    result in a new RefreshLink.
    Instead of a Boolean you could also use a string containing the path, or whatever you want.
    Imb.

  • Issue while importing table from oracle to sql server using import and export wizard

    Hi All,
    I am trying to populate oracle table to sql server using import export wizard  and i am getting the below error.the table is allready present in the database but still it throwing error like table doesn't exists.
    Could not connect source component.
    Error 0xc0202009: Source - JOB_ACTION_HISTORY [1]: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80004005.
    Error 0xc02020e8: Source - JOB_ACTION_HISTORY [1]: Opening a rowset for ""FLXUSER"."JOB_ACTION_HISTORY"" failed. Check that the object exists in the database.
     (SQL Server Import and Export Wizard)
    Kindly help me out
    Thanks in advance

    Hi Snehasis,
    Please check whether the table name in the Oracle database has lower case letters. The table name should be exactly correct. 
    In addition, the issue might be related to the Oracle driver. What provider/driver do you use? If you use Microsoft OLE DB Provider for Oracle, you can try the
    Oracle OLE DB Provider. If you use Enterprise or Developer edition of SSIS 2008 or higher, you can also try the
    Microsoft Connectors for Oracle by Attunity. The  Oracle OLE DB Provider and Microsoft Connectors for Oracle are proved to have better performance.
    Regards,
    Mike Yin
    TechNet Community Support

  • Export tables form Oracle8 to SQL Server 7.0

    Hello
    I use Dts (data transformation service) to export tables/data form Oracle8 to SQL Server 7.0. It seems to work fine, but somehow escape charecters like carrige return and spaces,are presented as a '' sign in SQL Server. How can I avoid this during the export of data from Oracle.(I do want to use a trigger to remove them afterwards !)Please help
    Regards Ivan

    CORRECTION !
    Bottom line should read:
    (I do NOT want to use a trigger to remove them afterwards !)
    Ivan
    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Ivan Posselt ([email protected]):
    Hello
    I use Dts (data transformation service) to export tables/data form Oracle8 to SQL Server 7.0. It seems to work fine, but somehow escape charecters like carrige return and spaces,are presented as a '' sign in SQL Server. How can I avoid this during the export of data from Oracle.(I do want to use a trigger to remove them afterwards !)Please help
    Regards Ivan<HR></BLOCKQUOTE>
    null

  • Load table structure definition from Sql server and mirroring

    Hi, we have to replicate some tables from sql server
    into SAP dictionary.
    Is there a tool/transaction for import the table structure
    from a DBRMS like sql/oracle ?
    Adn is there some third part solution for replicate data
    from/to sql server and Sap ?
    Thanks in advance.
    Riccardo Galli.

    Hi,
    Dont know if there are any tools for this but onething is sure you will need to create the table thru SE11.
    I had done something similar, created a BDC to create table and it works.
    Provide the BDC with list of fields, datatype, len, key fields and the BDC will create the table.
    You will need to activate the table once its created, for some reason sap put the table in "partial active" status after creation .
    Good luck.
    Ravi

  • Error  ORA-02019: while selecting table from oracle10g to SQL Server 2005

    Hi all,
    our oracle 10g database is on AIX 5.2 and i configures heterogeneous service and install oracle 10g cleint on windows 2003 server where SQL Server reside . i configured the following things but i got the error ORA-02019. please help me its very urgent. quick response will higly appreciated. thanks alot in advance.
    1)create Sytem DSN (mysqlserver) by selectin SQL Native cleint
    2)copy the existing entry and paste it in listener.ora file and edit it as below
    LISTENERMYSQLSERVERDSN =
    (ADDRESS_LIST=
    (ADDRESS=(PROTOCOL=tcp)(HOST= hostname of oracle database)(PORT=1521))
    (ADDRESS=(PROTOCOL=ipc)(KEY=PNPKEY)))
    SID_LIST_ =
    (SID_LIST=
    (SID_DESC=
    (SID_NAME= mysqlserver)
    (ORACLE_HOME = /u01/app/oracle/product/101)
    (PROGRAM=hsodbc)
    $lsnrctl status LISTENERMYSQLSERVERDSN
    It is working fine
    3) configure TNAMES.ora
    mysqlserver =
    (DESCRIPTION =
    (ADDRESS =
    (PROTOCOL = TCP)
    (HOST = 100.100.50.5)
    (PORT = 1521)
    (CONNECT_DATA =
    (SID = mysqlserver)
    (HS = OK)
    c:>tnsping mysqlserver
    it is workin fine
    4)copy inithsodbc.ora and make it initmysqlserver.ora
    HS_FDS_CONNECT_INFO = mysqlserver
    HS_FDS_TRACE_LEVEL = off
    4)create the database link
    sql>create database link mysqlserver
    connect to "sa" identified by "nsp@123" using 'mysqlserver';
    when i selecting SQL Server object from oracle i got below error
    SQL> select * from NSP_products@mysqlserver;
    select * from NSP_products@mysqlserver
    ERROR at line 1:
    ORA-02019: connection description for remote database not found
    pLease help me its very urgent.
    BEST REGARD

    Hi all,
    our oracle 10g database is on AIX 5.2 and i configures heterogeneous service and install oracle 10g cleint on windows 2003 server where SQL Server reside . i configured the following things but i got the error ORA-02019. please help me its very urgent. quick response will higly appreciated. thanks alot in advance.
    1)create Sytem DSN (mysqlserver) by selectin SQL Native cleint
    2)copy the existing entry and paste it in listener.ora file and edit it as below
    LISTENERMYSQLSERVERDSN =
    (ADDRESS_LIST=
    (ADDRESS=(PROTOCOL=tcp)(HOST= hostname of oracle database)(PORT=1521))
    (ADDRESS=(PROTOCOL=ipc)(KEY=PNPKEY)))
    SID_LIST_ =
    (SID_LIST=
    (SID_DESC=
    (SID_NAME= mysqlserver)
    (ORACLE_HOME = /u01/app/oracle/product/101)
    (PROGRAM=hsodbc)
    $lsnrctl status LISTENERMYSQLSERVERDSN
    It is working fine
    3) configure TNAMES.ora
    mysqlserver =
    (DESCRIPTION =
    (ADDRESS =
    (PROTOCOL = TCP)
    (HOST = 100.100.50.5)
    (PORT = 1521)
    (CONNECT_DATA =
    (SID = mysqlserver)
    (HS = OK)
    c:>tnsping mysqlserver
    it is workin fine
    4)copy inithsodbc.ora and make it initmysqlserver.ora
    HS_FDS_CONNECT_INFO = mysqlserver
    HS_FDS_TRACE_LEVEL = off
    4)create the database link
    sql>create database link mysqlserver
    connect to "sa" identified by "nsp@123" using 'mysqlserver';
    when i selecting SQL Server object from oracle i got below error
    SQL> select * from NSP_products@mysqlserver;
    select * from NSP_products@mysqlserver
    ERROR at line 1:
    ORA-02019: connection description for remote database not found
    pLease help me its very urgent.
    BEST REGARD

  • OIM 11g+Database Application Tables Resource Connectors+ MS SQL Server 2008

    Hello Experts:
    I installed DBAT 9.1.0.5.0 Resource Adapter on Linux 64 bit server using OIM 11g, I try to create Generic Connectors to configure Target Resource for MS SQL Server 2008 and after entering all the information on the second screen and click continue the screen gets stuck. This does not throw any kind of error nor any error msg are written to Log files. It's been difficult to debug the problem or know the root cause since there is no error msg thrown. No data is written from the sql server.
    I can ping to the sql server and port are open.
    Do we have to do any kind of setting on sql server to make this work?
    Does any one have ideas? Did any one face any issues like this before?
    Has any one worked with OIM connections with SQL server?
    Just throwing all these question as I am running out of ideas.
    Much help appreciated.
    Thanks.
    Edited by: 886912 on Dec 8, 2011 5:09 PM

    Thanks Rajiv for the quick reply.
    I did try local oracle server and there was no issue. And i even tried all kinds of browsers for SQL server and still the same issue.
    And also can you explain a bit more on the these enabling logs
    Also enable your logs like XELLERATE.WEBAPP and GTC related logs like
    Xellerate.GC.StartUp
    Xellerate.GC.ProviderRegistration
    Xellerate.GC.ImageGeneration
    Xellerate.GC.FrameworkProvisioning
    Xellerate.GC.Provider.ProvisioningFormat
    Xellerate.GC.Provider.ProvisioningTransport
    Xellerate.GC.FrameworkReconciliation Xellerate.GC.Provider.Reconciliation
    Format
    Xellerate.GC.Provider.Validation
    Xellerate.GC.Provider.Transformation
    Xellerate.GC.Model
    Xellerate.GC.Server
    I have done it the DBAT. How to do on these?
    Thanks

  • Is it possible to remove Locks in SQL server 200 using java code...???

    Hi floks,
    I had i trickey situation in which my application is creating the locks over the tables in the
    DB(SQL server 2000) . Iam using Struts frame work 1.1 + jsp in our application.
    Iam bit worried wether the locks can be removed with the java code which suits the Struts
    framework...
    Please help me with proper code snippet to over come the situation.
    Thanks in anticipation
    Shiv

    iam looking to make a query in such a way that it can be triggered with
    java code whish removes all the locks
    is it possible...?
    i tried the nolock situation even i cant get the situations
    and the query where it is getting locked as our application is big enough with
    numerous number of queries

  • About cluster table in sql server or SAP

    Hello Gurus,
            we have a cluster table "KONV" in our sql server 2008 , is that feature for cluster table native feature in sql server or in sap?
    because some professonal said there is no concept for cluster table in sql server just like oracle database. so please help me for
    clarification.
    Many thanks,

    I agree, this is ABAP Dictionary specific way of data encapulation, not the DB type dependant one. Basically it stores the data in RAW or LRAW format.
    Also be aware that we distinguish b/w [data clusters|http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3bf8358411d1829f0000e829fbfe/frameset.htm] and [cluster tables|http://help.sap.com/saphelp_nw04/helpdata/en/cf/21f083446011d189700000e8322d00/content.htm].
    Regards
    Marcin

  • Trigger to populate table in sql server database

    Maybe this isn't the right board to post this in, but here goes:
    We have an Oracle 9i database, with a table that get's populated with a new record every minute or so.
    We need to take some values from the newly inserted record and populate a table in a sql server database instantly. The people requesting this have not said as much, but I am thinking deletes and updates would need to be the same.
    How would it be best to do this? My first thought was a trigger on the oracle table that populates the sql server table via heterogeneous db link.
    Any other ideas?
    thanks in advance..
    update- repost in heterogeneous forum
    Edited by: user571263 on Mar 15, 2011 11:25 AM

    Maybe this isn't the right board to post this inI think you are right:
    Heterogeneous Connectivity
    Werner

  • How to fix name of table have space in goldengate 11.1.1.1.2 on SQL Server

    Problem Description: How to fix problem with the name of table have space in sql server?
    If I want to used with oracle golden gate 11g(v 11.1.1.1.2)
    Thank you

    I use
    Source:SQL Server 2000
    Target : Oracle
    Config Source:
    table dbo."New Table";
    Config Target:
    map dbo."New Table" , target xxx."NEW_TABLE";
    when check in process extract
    I find No active extraction maps after insert data
    Thank you N K

  • How to Create a Temporary Table with SQL Server

    I know you can create a temporary table in SQL Server 2000, but not quite sure how to do it in CFMX 7, i.e., does the SQL go inside a <CFQUERY dbtype="query"> tag?
    I'm pulling the main set of records from an Oracle server (1st data source), but it does not contain employee names, only employee IDs.  Since I need to show the employee name along with the Emp ID, I'm then pulling a list of "current" employee names from a SQL Server (2nd data source), which is the main database on our CF server.
    I've got a QofQ that works fine, except it only matches EmpIDs that exist in both result sets.  Employees who are no longer employed, don't match, and don't display.  Since I can't do a LEFT OUTER JOIN with a QofQ, what I need to do is get the records from the Oracle server into the SQL Server.  Preferably in a temporary table.
    I was hoping if I could get those Oracle records written to a temp table on the main SQL Server, in same database as the Employee Name table, I could then write a normal <CFQUERY> that uses a LEFT OUTER JOIN.
    I think I could probably write a Stored Procedure that would execute the SQL to create the temporary table, but am trying to avoid having to write the SP, and do it the simplest way.
    This query will be a program that can be run hundreds of times per day, with a form that allows users to select date ranges, locations, and other options.  That starts the queries, which creates the report.  So I just need the temp table to exist only until all the SQL has run, and the <CFOUTPUT> has generated a report.
    If the premise is right, I just need some help with the syntax for creating a SQL Server temp table, when you want to write records to it from an external data source.  I'm trying the following, but getting an error:
    <CFQUERY name="ITE_Temp" datasource="SkynetSQL">
    CREATE TABLE #MyTemp
    (   INSERT INTO #MyTemp
    ITE2.TrueFile char (7) NOT NULL,
    ITE2.CountOfEmployee int NULL,
    ITE2.DTL_SUBTOT decimal NULL,
    ITE2.EMPTYPE char (3) NULL,
    ITE2.ARPT_CD char (3) NULL
    </CFQUERY>
    So I actually created a permanent table on the SQL Server, and wrote the below SQL, which does work, and does write the records to table.  I can then write another CFQUERY with a LEFT OUTER JOIN, and get all the records, including those that don't have matching employee name:
    <CFQUERY datasource="SkynetSQL">
    <CFLOOP index="i" from="1" to = "#ITE2.RecordCount#">
    INSERT INTO ITE_Temp
       (FullFile,
       EmployeeCount,
       DTL_Amount,
       EmployeeType,
       station)
    VALUES  ('#ITE2.TrueFile[i]#',
       #ITE2.CountOfEmployee[i]#,
       #ITE2.DTL_SUBTOT[i]#,
       '#ITE2.EMPTYPE[i]#',
       '#ITE2.ARPT_CD[i]#')
    </CFLOOP>
    </CFQUERY>
    But, I hate to have to create a table and physically write to it.  For one, it seems slower, and doing it in temp would be in memory, and probably much faster, correct?  Is there some way to code the above, so that it does something similar, but in a TEMPORARY TABLE?   If I can figure out how to do this, I can pull data from multiple data sources and servers, and using SQL Server temp tables, work with the data as if it was all on the same SQL Server, and do some cool reports.
    Everything I've done for the past few years, has all been from data from a single source, whether SQL Server, or another server.  Now I need to start writing reports where data can come from 3 or 4 different servers, and be able to do joins (inner and outer).  Thanks for any advice/help.  Much appreciated.
    Gary

    While waiting to hear back, I was able to write the query results from an outside Oracle server, to a table on the local SQL Server, and do the LEFT OUTER JOIN required for the final query and report to work.  That was with this syntax:
    <CFQUERY name="AddTableRecords" datasource="MyTable">
    TRUNCATE TABLE ITE_Temp
    <CFOUTPUT query="ITE2">
    INSERT INTO ITE_Temp
    (FullFile,EmployeeCount,DTL_Amount,EmployeeType,station)
    VALUES
    ('#TrueFile#', #CountOfEmployee#, #DTL_SUBTOT#, '#EMPTYPE#', '#ARPT_CD#')
    </CFOUTPUT>
    </CFQUERY>
    However, I was not able to write to a temporary table AND read the results. I got the syntax to run to write the above results to a temporary table.  But when I tried to read and output the results from the temp table, I got an error.  Also, it wouldn't take the single "#" (local) only the global "##" table var, using this syntax.  Note that if I didn't have the DROP TABLE in the beginning, the 2nd time you run this query, you get an error telling you the table already exists.
    <CFQUERY name="ITE_Temp2" datasource="MyTable">
    DROP TABLE ##MyTemp2
    CREATE TABLE ##MyTemp2
    FullFile char (7) NOT NULL,
    EmployeeCount int NULL,
    DTL_Amount decimal NULL,
    EmployeeType char (3) NULL,
    station char (3) NULL
    <CFOUTPUT query="ITE2">
    INSERT INTO ##MyTemp2 VALUES
    '#ITE2.TrueFile#',
    #ITE2.CountOfEmployee#,
    #ITE2.DTL_SUBTOT#,
    '#ITE2.EMPTYPE#',
    '#ITE2.ARPT_CD#'
    </CFOUTPUT>
    </CFQUERY>
    So even though the above works, I could use some help in reading/writing the output.  I've tried several things similar to below, but they don't work.  It't telling me ITE_Temp2 does not exist.  It's not easy to find good examples of creating temporary tables in SQL Server.
    <CFQUERY name="QueryTest2" datasource="SkynetSQL">
    SELECT *
    FROM ITE_Temp2
    </CFQUERY>
    <CFOUTPUT query="ITE_Temp2">
    Output from Temp Table<br>
    <p>FullFile: #FullFile#, EmployeeCount: #EmployeeCount#</p>
    </CFOUTPUT>
    Thanks for any help/advice.
    Gary.

Maybe you are looking for

  • Over image not working in Nav Bar

    I have established Up and Over images for my nav bar. The Up image is all that shows -- even when I mouse-over or click on the button. Thanks for your help! Jim "MM_nbGroup('down','group1','WhatWeDo','Images_and_Video/WhatWeDo_Over.gif',1)" onmouseov

  • CachedRowSet problem in Weblogic 6.1 and Oracle thin driver 9.0.1

    Has anyone used the CachedRowSet class successfully? (this classes are new and from the JDBC extension pack) I am experiencing "Not in a transaction" errors when executing cachedrowset.populate(resultset), even though I'm inside a correct ut.begin an

  • X1 Carbon model numbers 34442HU and 3444AZU - what's the difference?

    Hi guys, I'm ready to buy a new X1 Carbon (non-touch version) but I found two model codes for the same price and would like to know if there's any difference between them. They're model numbers 3444-2HU and 3444-AZU. I checked Lenovo's Maintenance Ma

  • ISDN ERROR in PI XI

    Hello all, we have troubles with sending messages via ISDN line from PX0. Bellow on the screen you can see details. Thanks a lot for help error: ISDN Error occured (Capi runtime error: application 22033 class 4, value 1: Bearer capability not impleme

  • Single Serial Packet vs Multiple Packets

    Hello, I am trying to program a stepper controller (Anahiem Automation DPE25601) via a usb to serial connector.  Their manual doesn't say how to load a program onto it, so I got a serial port listener used their sample program and found out how to do