Code-only: Database name with periods

4 posts, 0 answers
  1. Tonny
    Tonny avatar
    10 posts
    Member since:
    Sep 2011

    Posted 24 Feb 2014 Link to this post

    After using OpenAccess in the Database-first scenario for a while, I decided to try Code-only for my new project, and faced a lot of trouble just getting started.

    One of these problems had to do with the name of the database to be generated. I initially named it with the domain name of the site it'll eventually become, but using a name with periods (Database=sub.somesite.tld) did not go so well. At first, it couldn't generate the database at all, failing with an SQL syntax error. Adding brackets around the name in the connection string (Database=[sub.somesite.tld]) fixed that and allowed the DB to be created, but this conn-string failed when OA tried to log in to the newly created DB, and "schemaHandler.DatabaseExists()" reported false even though the DB was clearly present on the server.

    I've got it running by replacing the periods in the name with underscores (Database=sub_somesite_tld) but I'm still interested in knowing if there's some way you can use a database with periods in the name with Telerik Data Access in the Code-only scenario.

    We use SQL Express 2012 on dev and SQL Server 2008/2012 Web Edition on the live servers.
  2. Kristian Nikolov
    Admin
    Kristian Nikolov avatar
    206 posts

    Posted 25 Feb 2014 Link to this post

    Hi Tonny,

    Thank you for contacting us.

    We managed to reproduce the behavior you have described. Unfortunately the cause for it is a bug on our side. Please accept our apologies for the caused inconvenience and find your Telerik Points updated for reporting this new bug. We have logged it in our backlog and it will be scheduled to be fixed in the future.

    Meanwhile, we can suggest you a workaround which would allow you to use full stops in the database name. The approach involves the usage of a second OpenAccessContext object which would be instantiated with a modified connection string. This secondary OpenAccessContext object will be used only for creating the database in case it does not already exist. I have attached a sample project illustrating the approach. In order to run the application you may need to upgrade the references to the OpenAccess assemblies. You may also need to update the connection strings defined in the app.config files according to your setup.

    I hope this helps. Should you have any more questions, do not hesitate to get back to us.

    Regards,
    Kristian Nikolov
    Telerik
    OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
  3. DevCraft banner
  4. Tonny
    Tonny avatar
    10 posts
    Member since:
    Sep 2011

    Posted 26 Feb 2014 in reply to Kristian Nikolov Link to this post

    Hi Kristian

    Thank you for the acknowledgement and the reasonable workaround.

    I'll adopt your approach with the conn-string manipulation in our code and look forward to seeing the bug fixed in a future release.
  5. Kristian Nikolov
    Admin
    Kristian Nikolov avatar
    206 posts

    Posted 26 Feb 2014 Link to this post

    Hi Tonny,

    We are glad that the workaround is applicable for your scenario. We will be sure to inform you in this thread when a fix is available.

    Meanwhile, in case you have additional questions or need assistance, feel free to contact us again via our Ticket System or post in our forums.

    Regards,
    Kristian Nikolov
    Telerik
    OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
Back to Top