none
EF to DB2 LINQ RRS feed

  • Question

  • I have been using EF for years with SQL Server but have to use IBM's DB2 for a project.

    The LINQ generated query needs to have double quotes around the names but does not.

    With EF 5.0 I get, for example:

    SELECT \r\nExtent1.TripId AS TripId\r\nFROM dbo.Trips AS Extent1\r\nWHERE '12345678' = Extent1.TripId

    DB2 requires:

    SELECT \r\nExtent1."TripId" AS "TripId"\r\nFROM "dbo"."Trips" AS Extent1\r\nWHERE '12345678' = Extent1."TripId"

    I see web post saying the EF adds the double quotes by default. Is there a configuration setting that is required?


    John Varney

    Thursday, October 3, 2013 3:37 PM

Answers

  • I have not been able to find a solution to the issue and have resorted to using all caps in the DB2 table and field names.

    John Varney

    Friday, October 11, 2013 12:18 AM

All replies

  • Hello johnvarney,

    Thanks for posting to this forum.

    As far as I know, the script is generated without double quotes by default because we use the provider for SQL Server.

    For DB2, it maybe need a suitable provider so that it can create a sql script for DB2.

    For this, there is a thread talking about it:

    http://social.msdn.microsoft.com/Forums/en-US/d49db3c1-a725-4f61-b7c2-c7ab1092a78e/linq-to-db2?forum=linqtosql

    Regards.


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    Friday, October 4, 2013 1:58 AM
    Moderator
  • Thanks Fred,

    I should have said that I am using the IBM.Data and IBM.Data.Entity dlls and specify the provider in the connection string. I get an error back from the database saying that it cannot find the "DBO.TRIPS" table so the query is reaching the database.

    It is interesting that you say that the sql is generated by the provider, which, thinking about it, makes sense as the provider knows the nuances of the required sql.

    I'll have a look there.

    Thanks,

    John


    John Varney

    Friday, October 4, 2013 3:34 AM
  • Hello johnvarney,

    Dose the issus have been resolved?

    If it is solved, and could you please share the solution.

    Thanks & Regards.


    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.

    Wednesday, October 9, 2013 9:25 AM
    Moderator
  • I have not been able to find a solution to the issue and have resorted to using all caps in the DB2 table and field names.

    John Varney

    Friday, October 11, 2013 12:18 AM
  • Hi,

    Sorry for that my suggestion is not helpful to you.

    And glad to hear that you found a way for this at last and share it with us.

    Thanks.


    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.

    Friday, October 11, 2013 3:25 AM
    Moderator