Trying to access CMS via C#

jmucchiellojmucchiello Posts: 1,076
edited April 19 in Daz Studio Discussion

I'm trying to do a simple select in the CMS from C# but nothing I try gets me to the tables. I've tried product "product" dzcontent.product "dzcontent"."product" etc. Nothing works. SHOW search_path lists dzcontent, public. So the schema name shouldn't be necessary:

conn.Open() is succeeding. So the connection string should be good: "host=127.0.0.1;port=17237;database=postgres;username=dzcms"

 Exception data:
    Severity: ERROR
    SqlState: 42P01
    MessageText: relation "product" does not exist
    Position: 22
    File: src\backend\parser\parse_relation.c
    Line: 984
    Routine: parserOpenTable

 

I would post the code but cloudflare thinks the code is an attack. All I'm doing is a trying get COUNT from "product".

select * from product

Post edited by jmucchiello on

Comments

  • SofaCitizenSofaCitizen Posts: 2,147

    I assume you have either Daz Studio or DIM running while trying to connect? The CMS does not run by default and so you'd normally need one of those two to launch it in the background. Other than that what you have tried should work. As someone who is more familiar with MySQL over PostgreSQL I was a little confused over the need to use quotes for the tables that are not all lowercase but product is one of the tables that is all lowercase (atleast on my install) and so a simple "SELECT COUNT(*) FROM product;" query should work fine.

    It shouldn't matter since both work for me but you can try connecting via localhost instead of 127.0.0.1 - not sure if hostname is part of the permissions as it can be for MySQL.

  • crosswindcrosswind Posts: 9,770

    I know nothing about C# but from database connection perspective, you want to connect to the database: Content rather than postgres. The latter has no tables. The table: product is under: Content > dzcontent.

    Pls check the screenshot down below.

     

    SNAG-2026-4-19-000.png
    1373 x 1108 - 95K
  • jmucchiellojmucchiello Posts: 1,076
    edited April 19

    crosswind said:

    I know nothing about C# but from database connection perspective, you want to connect to the database: Content rather than postgres. The latter has no tables. The table: product is under: Content > dzcontent.

    Pls check the screenshot down below.

    This was it! This is my first foray into the postgre flavor of SQL. I hadn't noticed the different database names. (And it works with either localhost or 127.0.0.1 to answer the other response.)

    Thanks.

    Post edited by jmucchiello on
  • kprkpr Posts: 375

    JIC...

    A helpful topic https://stackoverflow.com/questions/36753568/postgresql-tables-exists-but-getting-relation-does-not-exist-when-querying - Postgre documentation link among the comments

    Enjoy your 'poking around' smiley

  • jmucchiellojmucchiello Posts: 1,076

    I noticed a bunch "tblContent" entries with obsolete paths, mostly my own DUF files. Would something in Manage Content Databse solve that?

  • crosswindcrosswind Posts: 9,770

    jmucchiello said:

    I noticed a bunch "tblContent" entries with obsolete paths, mostly my own DUF files. Would something in Manage Content Databse solve that?

    No it would not. No tool in DS can solve those entries in table: tblContent. But you can leave them alone there since they don't impact anything in DS Smart Content or Content Library.

    Or, you can manually delete them by using SQL or DBA tools.

Sign In or Register to comment.