Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Help with WRDS JDBC error - can show and describe but not load tables

    Hello, I am trying to load WRDS tables using the newly-described JDBC connection as outlined in the blog: https://blog.stata.com/2022/01/27/wh...a-17-and-jdbc/

    The connection is set up correctly, and I can see tables and variables using "JDBC showtables" and "JDBC describe mytable".

    But when I try to load a table, using "JDBC load, table("mytable"): I get the error pasted below: (here I am using the table "fundq", which is from Compustat fundamentals quarterly:

    . jdbc load, table("fundq")
    SQL statements failed
    ERROR: relation "fundq" does not exist Position: 15
    r(682);

    I am not sure what the error is referring to, and I don't see information about it in the general JDBC page: https://www.stata.com/manuals/djdbc.pdf. I double checked that I have WRDS loaded with "JDBC showdbs", which returns WRDS.

    Happy to provide screenshots or other information; I do have a valid WRDS log in and connect to the data correctly online.

    Thank you.


  • #2
    Some databases require you to specify a schema before the table name, some do not. Depending on how WRDS is set up for your group, you may need to specify the schema.

    http://https://www.baeldung.com/jdbc-connect-to-schema

    You can also try the JDBC URL syntax

    Code:
    jdbc:postgresql://localhost:5432/mydatabase?currentSchema=myschema
    or the Stata syntax

    Code:
    jdbc load, table("schema.fundq")



    Comment


    • #3
      I'm trying to use WRDS using the jdbc connection facility that Stata provides.

      I have jdbc set up in the same way as Lenore, I can use commands like
      Code:
      jdbc showdbs
      and
      Code:
      jdbc describe wrds_forms
      successfully, but I'm getting the same error as Lenore when I try to run anything like
      Code:
      jdbc load, table("wrds_forms")
      . Googling tells me that the issue is probably related to the "schema" problem that Kevin has pointed out, but I have no idea how to use that information productively. Specifically, how do I find out what the appropriate schema is? I'm guessing that
      Code:
      myschema
      in the code that Kevin posted is a placeholder for some specific schema that I need. How do I find it?

      Thanks for your help!

      Comment


      • #4
        The database credentials usually provide enough information to figure out what your database's schema is. In many Db2 cases (that I'm aware of), the schema is the same as username. If you're set on using this particular code I'd try that, otherwise an exec/SELECT function will import the data.
        Last edited by Eric Makela; 06 Feb 2023, 22:55.

        Comment


        • #5
          Hi. Have you tried adding the library in front of your table? For example, jdbc load, table("comp.fundq") might work?

          Comment

          Working...
          X