Menu

Access to dashboard database

Help
2018-01-19
2018-01-29
  • Sócrates Aníbal Rivera Rivera

    I am trying to connect to dashboard database from C#.
    For testing I use the "local" database provided by the dashboard over a zip file.
    I understand the database is PostgreSQL compliant.
    So, I have a choice of tools to use:
    - ODBC (psqlODBC); or,
    - Ole db (Npgsql).
    I haven't had success. On the moment of creating the connection I get:
    - Odbc: ERROR [42001] ERROR: Syntax error in SQL statement "SET EXTRA_FLOAT_DIGITS[*] = 2 "; expected "@, AUTOCOMMIT, MVCC, EXCLUSIVE, IGNORECASE, PASSWORD, SALT, MODE, COMPRESS_LOB, DATABASE, COLLATION, CLUSTER, DATABASE_EVENT_LISTENER, ALLOW_LITERALS
    - Ole db: Unknown message code: 0
    I think the problem could be the versions I am using of the drivers (perhaps I should use some older versions).
    Can you provide any kind of help?
    It will be very appeciated.
    Thanks in advance.
    Sócrates A Rivera R

     
  • David Tuma

    David Tuma - 2018-01-26

    First, the good news: the error message you are receiving means that your process is connecting through ODBC and actually talking to the database. That's a good (and important) first step. You're receiving the SQL syntax error from the database itself.

    The database is implemented in Java; specifically, it is the H2 RDBMS. You can read more about the H2 database here: http://www.h2database.com/

    The developers of the H2 database have worked hard to recognize and respond to a wide variety of SQL statements that include the nuances of PostgreSQL syntax. But since PostgreSQL is a massive enterprise product, they can't possibly support every single statement that PostgreSQL can - just the most important/most commonly used ones.

    It appears that some portion of your code stack is proactively issuing the statement "SET EXTRA_FLOAT_DIGITS..." statement (shown in the error message) while connecting to the database. The H2 database apparently only recognizes SET statements that are configuring the variables "AUTOCOMMIT, MVCC, EXCLUSIVE, ..." as listed in the error message. Thus, it is giving an error.

    Here are some things you could try next:

    • Have you tried ignoring the error and just using the connection? Perhaps the failure of this SET statement is considered harmless, and you'll be allowed to start issuing SELECT statements anyway.
    • Look at the various software layers you're using to connect to the database (e.g. the C# database library, the ODBC connection configuration, etc). One of those layers is issuing the SET EXTRA_FLOAT_DIGITS command; see if you can figure out which, and disable that. I'm not proficient with C# database libraries or ODBC, but Google searches may help you here.
    • Try using an older version of the PostgreSQL driver, as recommmended by an H2 developer here: http://h2-database.66688.n3.nabble.com/ODBC-Error-td4033015.html
     
    • Sócrates Aníbal Rivera Rivera

      Thank you very much.
      It has solved my problem. I used an older version of driver (1.8.xxx).
      Thanks again.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.