Identity Field  in MS SQL Server

Hi All,
I'm new in JDBC. I'm trying to get the autogenerated value from an identity column in SQL Server, after an INSERT operation.
I was looking around and I found there is an smart way:
stmt.executeUpdate(str, Statement.RETURN_GENERATED_KEYS);
     ResultSet rs = stmt.getGeneratedKeys();
but the executeUpdate reports an UnsupportedOperationException.
I'm using jdbc-odbc-bridge.
What am I missing?
thanks in advance
arturo

>
but the executeUpdate reports an
UnsupportedOperationException.
I'm using jdbc-odbc-bridge.
What am I missing?Your driver does not do that.

Similar Messages

  • Get an image from a varbinary field in an SQL Server 2005 database

    Hi:
    In a varbinary(MAX) field of an SQL Server 2005 database I
    storage JPG images. I design a webservice that returns the
    following XML structure:
    Public Class IMAGEN
    Public ErrorConsulta As Long
    Public Imagen As Byte()
    End Class
    The response look like this:
    <FLEXOBTENERIMAGENResponse>
    <FLEXOBTENERIMAGENResult>
    <IMAGEN>
    <ErrorConsulta>0</ErrorConsulta>
    <Imagen>/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAgGBgcGBQgH....</Imagen>
    </IMAGEN>
    </FLEXOBTENERIMAGENResult>
    </FLEXOBTENERIMAGENResponse>
    Where the node Imagen are thousands of caracters that
    represents the JPG image.
    How can I show this JPG in an Image control of a Flex Builder
    2 or 3?
    If you need more information please let me know.
    Thanx in advance.

    Assuming that you have text fields storing the Y N then on
    the output you
    have a code block like this
    <%
    If recordset.fields.item("wheelchair").value = "Y" then
    %>
    <img src="images/wheelchair.gif">
    <%End if%>
    However is your field is set to be a Yes/No type then the
    best way is to
    write the test like this
    If recordset.fields.item("wheelchair").value = TRUE then
    Paul Whitham
    Certified Dreamweaver MX2004 Professional
    Adobe Community Expert - Dreamweaver
    Valleybiz Internet Design
    www.valleybiz.net
    "Lancs" <[email protected]> wrote in message
    news:e6srl5$jul$[email protected]..
    > Using ASP/VBscript and Access
    > I'm making a page that dislays a listing of
    organisations (using Repeated
    > Regions) concerned with disabilities. I want to use
    images for symbols
    > that
    > indicate whether, for example, an organisation uses
    textphones, has
    > wheelchair
    > access, and the like. I'm using a form to add new
    records to the database.
    > I
    > want the form to allow users to select the applicable
    symbols using
    > checkboxes.
    > What code will allow the listing page to interpret a Y
    value as an image
    > path
    > and ignore a N value.
    > Thanks
    >

  • Problem in EOImpl.doDML() ,with Identity column in MS SQL server.

    Hello,
    I'm using JDeveloper 11.1.1.4.0
    My application is working with MS SQL Server.
    One of the tables in the database has its PK as Identity column.
    EO is created with the corresponding attribute as Primary Key.
    Upon calling doDML() in EOImpl, it generates an insert statement and attempts to insert in the PK field as well. MS SQL does not allow insertion in PK field and throws exception.
    I tried setting some configuration on EO PK attribute, but in vein. Also there is no other 'unique' column in table that can be setup as PK in EO.
    Appreciate your suggestions.
    Regards,
    Amar

    i think better to Oracle datbase as I am afraid of that Oracle won't be able to see your problem against sql server due to sql server is not their product!

  • Reset Identity Column Value in SQL Server depending on whats being inserted

    I have a SQL Server 2008 database with a table that has an ID field that has an identity increment and seed of 1.
    This work great as each new record created automatically gets a new and distinct number.
    Now when I insert certain new records I need to be able to make that value start at 10001 and then the next would be 10002 etc.
    But this is only for certain inserts.
    Is there a way to control the identity seed & increment on the fly via a query maybe?
    So some inserts would follow 1,2,3,4,5,6,7  depending on whats being inserted
    and others would follow 10001,10002,10003 depending on whats being inserted.
    is this possible?

    Make it a different field.  Don't mess with your PK.
    Make sure you have a plan for when you get 10000 records in this table.

  • Data type error when linking Salesforce field to MS SQL Server field?

    Hello.  I'm using CR XI R2 SP4 with the Salesforce 3.0 driver.  I have MS SQL 2000 SP4.  I want to create a standard report that links the Salesforce Contacts table with a table in my local SQL 2000 database - the table also contains a column with the contact ID values.  When I try to link using the Contact ID field, Crystal gives me an error "Data types are not compatible."
    The ID column data type in my SQL database is CHAR(18).  Is there a type I should use to make it work with Salesforce?
    Thanks
    David

    Thanks for your reply.  In Salesforce, ID is a special data type - I don't know what it would match in SQL.  I'll have to open a case with them to see if they can tell me.

  • Anyone else having issues writting string "memo" fields to Access 2007-2010 or SQL Server Express 2008-2012?

    I have a data cluster that I am working to write to either Access 2007 thru 2010 and/or SQL Server Express 2008 thru 2012 all on a Windows 7 64 bit OS. Some of the elements are long strings that I put delimited data for the raw trace data. The fields can be 10's of KB long. With Access I cannot stuff any string >255char into the memo field. With SQL Server Express 2008R2 - 2012 I found that if the strings are >32767 they again fail to fill the memo fields. The Access write or reads work fine otherwise, just not the listed offending fields in the cases mentioned.  Anyone else having the issue or a solution?

    If the long string field has repetitive data, you might be able to compress it using GZIP to reduce it's size below the 32K limitation you mentioned.
    GZIP compress/uncompress of string using .NET
    Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
    If you don't hate time zones, you're not a real programmer.
    "You are what you don't automate"
    Inplaceness is synonymous with insidiousness

  • Moving Access table with an autonumber key to SQL Server table with an identity key

    I have an SSIS package that is moving data from an Access 2010 database to a SQL Server 2008 R2 database.  Two of the tables that I am migrating have identity keys in the SQL Server tables and I need to be able to move the autonumber keys to the SQL
    Server tables.  I am executing a SQL Script to set the IDENTITY_INSERT ON before I execute the Data Flow task moving the data and then execute a SQL Script to set the IDENTITY_INSERT OFF after executing the Data Flow task.
    It is failing with an error that says:
    An OLE DB record is available.  Source: "Microsoft SQL Server Native Client 10.0"  Hresult: 0x80040E21  Description: "Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was
    done.".
    Error: 0xC020901C at PGAccountContractDetail, PGAccountContractDetail [208]: There was an error with input column "ID" (246) on input "OLE DB Destination Input" (221). The column status returned was: "User does not have permission to
    write to this column.".
    Error: 0xC0209029 at PGAccountContractDetail, PGAccountContractDetail [208]: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR.  The "input "OLE DB Destination Input" (221)" failed because error code 0xC020907C occurred, and the
    error row disposition on "input "OLE DB Destination Input" (221)" specifies failure on error. An error occurred on the specified object of the specified component.  There may be error messages posted before this with more information
    about the failure.
    Error: 0xC0047022 at PGAccountContractDetail, SSIS.Pipeline: SSIS Error Code DTS_E_PROCESSINPUTFAILED.  The ProcessInput method on component "PGAccountContractDetail" (208) failed with error code 0xC0209029 while processing input "OLE DB
    Destination Input" (221). The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running.  There may be error messages posted
    before this with more information about the failure.
    Any ideas on what is causing this error?  I am thinking it is the identity key in SQL Server that is not allowing the update.  But, I do not understand why if I set IDENTITY_INSERT ON.  
    Thanks in advance for any help/guidance provided.

    I suspect it is the security as specified in the message. E.g .your DBA set the ID columns so no user can override values in it.
    And I suggest you 1st put the data into a staging table, then push it to the destination, this does not resolve the issue, but ensures better processing.
    Arthur
    MyBlog
    Twitter

  • Migrating CMP EJB mapped to SQL Server table with identity column from WL

    Hi,
        I want to migrate an application from Weblogic to SAP Netweaver 2004s (7.0). We had successfully migrated this application to an earlier version of Netweaver. I have a number of CMP EJBs which are mapped to SQL Server tables with the PK as identity columns(autogenerated by SQL Server). I am having difficulty mapping the same in persistant.xml. This scenario works perfectly well in Weblogic and worked by using ejb-pk in an earlier version of Netweaver.
       Please let me know how to proceed.
    -Sekhar

    I suspect it is the security as specified in the message. E.g .your DBA set the ID columns so no user can override values in it.
    And I suggest you 1st put the data into a staging table, then push it to the destination, this does not resolve the issue, but ensures better processing.
    Arthur
    MyBlog
    Twitter

  • Error Message Using DB.Execute on SQL Server - Must use dbSeeChanges

    Uh, found a post indicating that dbFailOnError and dbSeeChanges are enumerated and that to designate them both, just add them together, but its not working and I'm still getting the ever popular 'You must use the dbSeeChanges option with OpenRecordset when
    accessing a SQL Server table that has an IDENTITY column.'.
    Public Function deleteTrailerActivityHeaderAndChildren(lngTrailerActivityHeaderId As Long)
    On Error GoTo Err_deleteTrailerActivityHeaderAndChildren
        Dim wrksp As DAO.Workspace
        Dim db As DAO.Database
        Dim strDeleteChild As String
        Dim strDeleteParent As String
        Dim strComment As String
        Dim errLoop As Error
        strDeleteChild = "DELETE * FROM tblTrailerUtilizationDetails WHERE lngTrailerActivityHeaderId = " & lngTrailerActivityHeaderId
        strDeleteParent = "DELETE * FROM tblTrailerActivityHeaders WHERE lngTrailerActivityHeader = " & lngTrailerActivityHeaderId
        Set wrksp = DBEngine.Workspaces(0)
        Set db = CurrentDb
        wrksp.BeginTrans
        On Error GoTo Err_dbExecute
            strComment = "Delete child records"
            db.Execute strDeleteChild, dbFailOnError + dbSeeChanges
            If DBEngine.Errors.Count = 0 Then
                strComment = "Delete parent"
                db.Execute strDeleteParent, dbFailOnError + dbSeeChanges
                    If DBEngine.Errors.Count = 0 Then
                        strComment = "Commit changes"
                        wrksp.CommitTrans
                    Else
                        strComment = "Rollback changes to tblTrailerActivityHeaders"
                        wrksp.Rollback
                        MsgBox "Record cannot be deleted. Unable to delete the Trailer Utilization Detail records.", vbCritical
                    End If
            Else
                strComment = "Rollback changes to tblTrailerUtilizationDetails"
                wrksp.Rollback
                MsgBox "Record cannot be deleted. Unable to delete the Trailer Utilization Detail records.", vbCritical
            End If
        Debug.Print DBEngine.Errors(0).Description
        On Error GoTo Err_deleteTrailerActivityHeaderAndChildren
        Set db = Nothing
        Set wrksp = Nothing
    Exit_deleteTrailerActivityHeaderAndChildren:
        Exit Function
    Err_deleteTrailerActivityHeaderAndChildren:
        MsgBox getDefaultErrorMessage("Module - Manage TrailerUtilization Details", "deleteTrailerActivityHeaderAndChildren", Err.Number, Err.Description), vbCritical
        Resume Exit_deleteTrailerActivityHeaderAndChildren
    Err_dbExecute:
        If DBEngine.Errors.Count > 0 Then
            For Each errLoop In DBEngine.Errors
                Debug.Print getDefaultErrorMessage("Module - ManageTrailerUtilizationDetails", "deleteTrailerActivityHeaderAndChildren.Err_dbExecute", errLoop.Number, , "(" & strComment & ") " &
    errLoop.Description)
            Next errLoop
        End If
        Resume Next
    End Function
    David H

    Hi aychekay
    Try following:
    - Add a TimeStamp Datatype Column to the table on the SQL Server
    - Rebind the tables into your database
    - Try your code again
    You never should run an Access Application against an SQL Server in readwrite mode without having TimeStamp datatype columns in your tables. Already for performance reasons this is a must and also, if you have datetime datatype fields on
    the SQL Server that are not exclusively maintained by Access, as the SQL Server may add miliseconds when writing the data. Same for Single precision datatypes, that may be rounded until you get the result back from the server. If you have a Timestamp datatype
    column in your table then Access is sure the record wasn't changed in the meantime and will not recheck the received record again against the database for changes in one of it's fields.
    Henry
    <aychekay> wrote in message
    news:[email protected]...
    This problem didn't go away yet. I'm having it too in Access 2007 (SP2 not installed yet) with a SQL Server 2008 Express backend. I'm sure my code is not reference any form controls or other object references. Access just complains if you try to run an Execute
    with "DELETE" on a table that has an identity column. I've resorted to deleting using a DAO recordset and loop instead for now.
    I actually started out using MySQL with MySQL's ODBC drivers and my statement worked fine. Only when I migrated to SQL Server did I start to have this problem.
    Just sayin...

  • How to Configure Remote Connections To SQL Server 2008 R2 Express

    Post written June 10, 2010 and pertains to:
    SQL Server 2008 R2 Express on both my server and local machines: SQLX_SRV,
    SQLX_LOC
    SQL Server 2008 R2 Management Studio on both my server and local machines:
    MS_SRV, MS_LOC
    Windows Server 2008 R2 Enterprise installed on a Hyper-V VPS: WS
    SQL Server Configuration Manager on both my server and local machines:
    CMGR_SRV, CMGR_LOC
    Server Manager: SMGR
    I am connecting to my hosting server via Remote Desktop Connection: RDC
    I installed SQLX_SRV and MS_SRV on my hosting server and SQLX_LOC and MS_LOC on my local development machine.  I am able to use MS_LOC to connect to SQLX_LOC and to use MS_SRV to connect to SQLX_SRV.  However I am not able to use MS_LOC to connect
    with SQLX_SRV.  Here's what I have done so far:
    SMGR -> Configuration -> Windows Firewall to turn off the Windows Firewall for Domain, Private and Public profiles.  Obviously I'll change this later, but until I can connect I want to remove as many variables as possible.
    CMGR_SRV -> SQL Server Services to confirm that both SQL Server (SQLEXPRESS) and SQL Server Browser services were running.
    CMGR_SRV -> SQL Server Network Configuration -> Protocols for SQLEXPRESS to ENABLE the Shared Memory, Named Pipes, and TCP/IP protocols and DISABLE the deprecated VIA protocol.
    CMGR_SRV -> SQL Server Network Configuration -> Protocols for SQLEXPRESS -> double click TCP/IP to open the TCP/IP properties dialogue.  On the Protocol tab Enabled: Yes, Keep Alive: 30000, changed Listen All to No.  I've tried it both
    ways, but I've got six IP addresses on my server and I wanted to configure SQLEXPRESS to listen to only the first and primary IP.  On the IP Addresses tab went to IPALL and cleared the TCP Dynamic Ports field and entered 1433 in the TCP Port field. 
    For my first and primary IP Address I made sure that Enabled was Yes, I cleared the TCP Dynamic Ports field, and entered 1433 in the TCP Port field.  For all other IP Addresses Enabled was set to No and I cleared both the TCP Dynamic Ports and TCP Port
    fields.
    CMGR_SRV -> SQL Server Services -> SQL Server (SQLEXPRESS) right click and Restart.  This of course stopped and restarted my instance of SQLX_SRV enabling the TCP/IP configuration in the previous step to take effect.
    On my server, SQLX_SRV is the only instance of SQL Server running and so it's easy to hard wire it to the default port 1433.
    The instance name for both SQLX_SRV and SQLX_LOC is the default "SQLEXPRESS".  My server machine name is "SERVER1" on the EnglishBrains.com domain.  So the proper local name (local within the context of my remote server as connected via RDC) for
    my instance of SQLX_SRV would be:
    SERVER1\SQLEXPRESS 
    Note the use of a backslash NOT a forward slash. 
    Of course to connect remotely from my development machine, which is not on the same domain as my hosting server, I would need to specify the domain as well, so the SQL Server name becomes:
    SERVER1.EnglishBrains.com\SQLEXPRESS
    I must also use SQL Server Authentication.  Before I can use such a remote connection, however, there are still several configuration steps required.  So on my server (connected via RDC) I used MS_SRV to connect to SQLX_SRV using SERVER1\SQLEXPRESS
    for the server name and Windows Authentication.  Once connected I performed the following steps:
    MS_SRV -> right click the connected parent SERVER1\SQLEXPRESS instance node at the top -> Properties -> Security -> Server authentication: select "SQL Server and Windows Authentication mode".  This will enable connections using either type
    of authentication.
    Next, leaving the Server Properties dialogue open, Connections -> check "Allow remote connections to this server" box.
    Click OK to save these changes and close the Server Properties dialogue.
    MS_SRV -> Security -> right click Logins and select "New Login...", the Login - New dialogue opens.
    On the General page Enter a name for your new login
    Select SQL Server Authorization
    Enter and confirm a password
    Uncheck Enforce password expiration
    Select the default Database and Language
    On the ServerRoles page Public will be checked, also check SysAdmin.  This is probably not a good idea and I'll uncheck this as soon as I can connect to the SQLX_SRV.
    On the User Mapping page select the databases you want your new Login to access and enter the Default Schema of "dbo".
    At the bottom of the User Mapping page you'll see the Database Roles table.  Public will be selected by default.  Also select db_Owner.  Again this is probably not a good idea, and I'll refine this once I can connect.
    On the Status page confirm that "Grant" is checked under "Permission to connect to database engine" and "Enable" is checked under "Login".
    Click OK to save all changes and close the Login - New dialogue.
    With these steps completed you should now be able to use MS_SRV to connect to SQLX_SRV using SQL Server Authentication by supplying the name and password for your new Login.  I tried this and it worked fine.  Next I tried to use this same login
    remotely, that is I went to my local development machine and used MS_LOC to try and connect to SQLX_SRV by using
    SERVER1.EnglishBrains.com\SQLEXPRESS
    and opting for SQL Server Authentication and supplying the name and password of my new login.
    THIS DID NOT WORK??  Instead I get the following error message:
    Cannot connect to SERVER1.EnglishBrains.com\SQLEXPRESS.
    A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider:
    SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) (Microsoft SQL Server, Error: -1)
    For help, click:
    http://www.microsoft.com/products/ee/transform.aspx?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=-1
    If you follow the suggested help link, you are told:
    The SQL Server client cannot connect to the server.  This error could be caused by one of the following reasons:
    A specified SQL Server instance name is not valid.
    The TCP, or named pipes protocols are not enabled.
    The firewall on the server has refused the connection.
    The SQL Server Browser service (sqlbrowser) is not started.
    WRONG on all 4 counts!  The instance name IS valid.  Both TCP/IP and Named Pipes protocols are enabled.  The firewall has been shut down, so it is not relevant.  Finally the SQL Server Browser IS started.
    The next thing I tried was to circumvent discovery by the SQL Browser service by using the following syntax to specify the IP address and port directly when specifying the SQL Server name.
    tcp:68.71.134.186,1433
    Using this in the Server Name field I was able to use MS_SRV to successfully connect to SQLX_SRV (using SQL Server Authentication of course) with or without the SQL Browser service running. 
    However when I tried to connect from MS_LOC to SQLX_SRV using this same login (WITH SQL Browser service running just for good measure) it does not work??  I get the following error message:
    Cannot connect to tcp:68.71.134.186,1433.
    A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider:
    TCP Provider, error: 0 - A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.) (Microsoft SQL Server, Error: 10060)
    For help, click:
    http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=10060&LinkId=20476
    If you follow the help link you are told:
    "The SQL Server client cannot connect to the server. This error could occur because either the firewall on the server has refused the connection or the server is not configured to accept remote connections."
    However, the firewall has been shut down and the server HAS been configured to accept remote connections! 
    I confirmed that i could indeed Ping to 68.71.134.186  and running NetStat -a |find /i "listening" on the server shows that the server is indeed listening at 68.71.134.186 Port 1433 -- which is why I was able to connect to SQLX_SRV using MS_SRV with
    tcp:68.71.134.186,1433 .
    IN SUMMARY: Even though I can connect to my SQLEXPRESS instance multiple ways from the server itself, I cannot connect remotely from my development machine! 
    If anyone can help me figure out why I would be very, very grateful!

    My two cents to help you out on c# code example to configure the remote sql server express.
    Hope it helps. It works, but you have to be extra carefull to read it all and setup the server configuration and netsh commands; also the port fowarding on the router.
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Data.SqlClient;
    namespace sqlremoteconnection
    class Program
    static void Main(string[] args)
    // this is the local sql server connection
    // 192.168.1.101\SQLEXPRESS
    // now, the configuration for remote access:
    // activate SQL SERVER BROWSER - set it to start "automatic"; then START UP
    // SQL Server Configuration Manager
    // --> SQL SERVER BROWSER -> properties -> Service -> Start Mode -> automatic -> apply
    // --> Log On -> Start -> Ok
                // netsh firewall set portopening protocol = TCP port = 1433 name = SQLPort mode = ENABLE scope = all profile = CURRENT
                // netsh firewall set portopening protocol = UDP port = 1434 name = SQLPort mode = ENABLE scope = all profile = CURRENT
                // netsh advfirewall firewall add rule name = SQLPort dir = in protocol = tcp action = allow localport = 1433 remoteip = any profile = PUBLIC
                // netsh advfirewall firewall add rule name = SQLPort dir = in protocol = udp action = allow localport = 1434 remoteip = any profile = PUBLIC
    // VERY IMPORTANT FOR REMOTE ACCESS: you have to add the rules on port fowarding
    // on the router!!!
    // TCP: 1433
    // UDP: 1434
    // or just a personal port like TCP 31433/UDP 31434
    // read carefully the netsh commands above
    // server name: 123.132.24.177\SQLEXPRESS
    // server name: anyurl.myftp.org\SQLEXPRESS,1433 <<-- regular port
    // server name: anyurl.myftp.org\SQLEXPRESS
    // server name: anyurl.myftp.org\SQLEXPRESS,31433 <<-- WOW different PORT here!!!
    SqlConnection myConnection = new SqlConnection(
    "user id=sa;" +
    "password=password_goes_here!;" +
    "server=anyurl.myftp.org\\SQLEXPRESS,31433;" +
    //"Trusted_Connection=no;" +
    "database=database_name_here; " +
    "connection timeout=30");
    try
    myConnection.Open();
    catch (Exception e)
    Console.WriteLine(e.ToString());
    try
    SqlDataReader myReader = null;
    SqlCommand myCommand = new SqlCommand("select * from mytable", myConnection);
    myReader = myCommand.ExecuteReader();
    while (myReader.Read())
    Console.WriteLine(myReader["tab01_name"].ToString());
    Console.WriteLine(myReader["tab01_age"].ToString());
    catch (Exception e)
    Console.WriteLine(e.ToString());
    try
    myConnection.Close();
    catch (Exception e)
    Console.WriteLine(e.ToString());
    Adelino Araujo

  • BI 7.3 delta extraction with SQL Server 2008

    Hi experts,
    I'm trying to extract data with delta update from a SQL Server with UD Connect, i test this ways:
    Field DateTime in SQL Server: The problem is I only can delta within a day, no changes detected in the same day because SAP detects two fields here date and time, and can only can reference date field as a delta field.
    Field TimesTamp in SQL Server: The problem seems the same, SAP recognize this as a date and time field.
    Can any explain here the correct way for a delta implementation with SQL Server 2008? I would be very grateful.
    Regards,

    Hi Fernando
    That is what I need to do.
    Create a Model from an existing SQL Server database with the Import data Dictionary option , be able to modify tables structures, extended properties in the model, and then sync those changes with the database.
    So far I can't import the extended properties with DM 3.1.1. If you find a way , please let me know.
    Thanks,
    Jorge

  • SQL Server 2012 Physical vs. Hyper-V Same Query Different Results

    I have a database that is on physical hardware (16 CPU's, 32GB Ram).
    I have a copy of the database that was attached to a virtual Hyper-V server (16 CPU's, 32GB Ram).
    Both Servers and SQL Servers are identical OS=2008R2 Standard, SQL Server 2012R2 Standard same patch level SP1 CU8.
    Same query run on both servers return same data set, but the time is much different 26 Sec on Physical, 5 minutes on virtual.
    Statistics are identical on both databases, query execution plane is identical on both queries.
    Indices are identical on both databases.
    When I use set statistics IO, I get different results between the two servers.
    One table in particular (366k rows) on physical shows logical reads of 15400, on Hyper-V reports logical reads of 418,000,000 that is four hundred eighteen million for the same table.
    When the query is run on the physical it uses no CPU, when run on the Hyper-V it takes 100% of all 16 processors.
    I have experimented with Maxdop and it does exactly what it should by limiting processors but it doesn't fix the issue.

    A massive difference in logical reads usually hints at differences in the query plan.
    When you compare query plans, it is essential that you look at actual query plans.
    Please note that if your server / Hyper-V supports parallelism (which is almost always nowadays), then you are likely to have two query plans: a parallel and a serial query plan. Of course the actual query plan will make clear which one is used in which
    case.
    To say this again, this is by far the most likely reason for your problem.
    There are other (unlikely) reasons that could be the case here:
    runaway parallel threads or other bugs in the optimizer or engine. Make sure you have installed the latest service pack
    Maybe the slow server (Hyper-V) has extreme fragmentation in the relevant tables
    As mentioned by Erland, you have much much more information about the query and query plan than we do. You already know whether or not parallelism is used, how many threads are being used in it, if you have no, one or several Loop Joins in the query (my
    bet is on at least one, possibly more), etc. etc.
    With the limited information you can share (or choose to share), involving PSS is probably your best course of action.
    Gert-Jan

  • Inserting date from a jsp into sql server 2005 database

    Dear Friends.,
    i have a jsp page, in that there is a form with various user input fields. in that one field is date field. i tried to insert the date field into the sql server 2005 database. but it is not getting inserted into the database.
    when i tried by inserting one field to database, it is getting inserted. for all the fields its works fine, except the date field.
    i need hint or code to insert the date get from the jsp page to database.
    i am using a servlet to do all database related things. i.e making connections, executing prepared statement queries
    thanks
    sekar.

    The variable needs to be outside of the string to be recognized as a variable. You need to remove the variable from the string, then concatinate it onto the string (and concatinate any remaining string parts - the closing paren). For example:
    stmt.executeUpdate("INSERT INTO table VALUES ('test', " + companyID + ")");
    Hope that's clear enough and helps. Good luck on your thesis!
    jim

  • Linking a PDF to a SQL Server

    Is there a way to filling, ie customer information fields, using a SQL server using a PDF? I am trying to create a document that allows the company I work for to create a Invoice using the information they already have on their server.

    You can do it with XFA forms in LiveCycle Designer, but not with PDF forms in Acrobat.

  • Blank Image when using a gif image from a SQL Server Database

    Post Author: scsmith
    CA Forum: Publishing
    Hello,
    I'm trying to use a field from a SQL Server DB that has embedded GIF files. In Crystal Reports when I add the field to the report the picture is blank for every row. Any ideas?

    Post Author: kchiu
    CA Forum: Publishing
    i'm having the same issue. 
    I believe crystal doesn't support gif datatypes.
    I'm trying to either convert the images, or find a work around in crystal, but haven't found anything.

Maybe you are looking for

  • IOS 5.0 or Later Suggestions

    My Number One Idea:   Wi-Fi through the iPod cable!! WHY, you may ask.  I DROPPED MY IPOD IN THE WATER AND FRIED THE Wi-Fi AND BlueTooth!!! I believe Wi-Fi/Internet through the iPod Touch's cable will make a sale booster for Apple, and it will help t

  • Problem trying to call a web service.

    I have a CF page that needs to use user authentication from an ASP.NET machine, so I'm trying to call a web service to determine whether or not the user has been authenticated. I'm using this code: <cfinvoke     webservice="https://my-domain.com/Sess

  • I am using ios 4.2 gm how can i upgrade to ios 4.3.3 without any error?, i am using ios 4.2 gm how can i upgrade to ios 4.3.3 without any error?

    i am using ios 4.2 8c134, i can't upgrade to any ios.. but ios 5.xx above i not try yet.. any suggestion or ideas to make sure the upgrade will work? sorry for my bad english.. 

  • Can I delete the Japanese Dictionaries?

    I was looking through the Library and came across the Dictionaries folder and it has 3 Japanese dictionaries. Can I delete them? I do not speak Japanese and do not forsee any reason to keep them. Just want to make sure. Thom

  • Is this real? Adobe Ovation 2.0 License?

    I found the following webpage but it makes no sense because as far as I know Adobe has not created a 2.0 version of Ovation (which is extremely disappointing that they have not ). Another reason I think it is strange is that their "academic" pricing