Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Bjarne Fyrstenborg 1281 posts 3992 karma points MVP 8x c-trib
    Jun 20, 2012 @ 08:50
    Bjarne Fyrstenborg
    0

    SQL query in starterkit 2.1.0.1

    Hi...

    I noticed you have changed in the SQL query from starterkit v. 2.0.2.0 to  v. 2.1.0.1, where v. 2.0.2.0 set the owner to dbo then in version 2.1.0.1 it haven't a reference with dbo when creating the tables.

    An example:

    v. 2.0.2.0

    CREATE TABLE [dbo].[umbracoLog]

    v. 2.1.0.1

    CREATE TABLE [umbracoLog]

    This means that when I access e.g. Tea Commerce section I get this error, because there isn't any tables with dbo.

    Invalid object name 'dbo.TeaCommerce_OrderStatus'.

    and also the same problem when publishing a content node:

    Invalid object name 'dbo.TeaCommerce_MasterProduct_rel_LanguageProducts'.

    /Bjarne

  • Anders Burla 2560 posts 8256 karma points
    Jun 20, 2012 @ 09:07
    Anders Burla
    0

    Hi Bjarne

    dbo is the owner of the DB. So you should be able to set the owner of the DB and its tables to dbo. I haven't tried this. But we use the starter kit our self and we have never had this problem. Try look through all the settings you can set when you create your DB.

    Kind regards
    Anders

  • Bjarne Fyrstenborg 1281 posts 3992 karma points MVP 8x c-trib
    Jun 20, 2012 @ 10:29
    Bjarne Fyrstenborg
    0

    Hi Anders

    Yes, but when I execute the script to a database at Surftown, it set the login user I have created (and is using in web.config) as owner and therefore no reference to dbo as in the error messages.

    I'm not sure how much permissions I have to the database. E.g. they don't let you backup the database with the included backup tool of Microsoft SQL Management Studio, so I have to script the database to create a backup.

    But I can probably add [dbo]. in SQL before each table, so dbo is set as owner instead of the login username.

    Is there some places in the Tea Commerce code, where it reference to dbo.tablename e.g. dbo.TeaCommerce_OrderStatus as above?
    So the database owner should be set to dbo.

    I will take a closer look to see if I can solve this..
    But I hadn't any problem in version 2.0.2.0 where it has dbo set in SQL and set owner to dbo.

    /Bjarne 

  • Bjarne Fyrstenborg 1281 posts 3992 karma points MVP 8x c-trib
    Jun 20, 2012 @ 21:01
    Bjarne Fyrstenborg
    0

    Hi Anders

    I have updated the SQL query to add [dbo]. before each table.. and now I'm able to access Tea Commerce section and publish content nodes without any errors..

    You haven't any places in the code where is reference to dbo, which perhaps not is updated from a previosly version of the starter kit?

    Perhaps it's working fine local if dbo is set to default, but at Surftown it adds the login username as owner, when not using [dbo].

    /Bjarne

  • Peter 89 posts 160 karma points
    Oct 15, 2012 @ 23:26
    Peter
    0

    Hey there, 

    I might be misunderstanding what is happening here, but I'm not sure that adding [dbo]. to everything is a wise idea. Adding [dbo]. to code and to the db scripts isn't the solution. I think the solution is to remove all references in the code for [dbo].

    The scripts should run as whoever is running them. If the database user has a schema associatied with it (which Bjarne seems to experiance and is common in shared hosting) you might not have access to dbo and can cause troubles down the line. I have experianced the same problem  due to security reasons and having seperate schemas for the site instances It seems that something in code is calling for a table with the [dbo]. schema. 

    If you are using shared hosting you can probably get around this by running the following script to get teacommerce to work

    ALTER SCHEMA dbo TRANSFER [SchemaName].TeaCommerce_VATGroup_rel_Country

    and do this for all the tables.

    You can get the db to print the list of scripts by running this, and then running its output.

    SELECT 'ALTER SCHEMA dbo TRANSFER ' + s.Name + '.' + p.Name FROM
    sys.tables p INNER JOIN sys.Schemas s on p.schema_id = s.schema_id
    where s.Name = 'SchemaName' 

    You will obviously need to change SchemaName for the schema name you have.

    Sorry If I have missed the point, but hopefully the alter schema scripts might help someone.

    P

  • Anders Burla 2560 posts 8256 karma points
    Oct 16, 2012 @ 12:09
    Anders Burla
    1

    Hi Peter

    Thanks for the extra info! We will try to make the starter kit version 2 as a normal umbraco package or have the DB script support different schemas

    Kind regards
    Anders

Please Sign in or register to post replies

Write your reply to:

Draft