No data sources are configured to run this SQL

后端 未结 3 1529
甜味超标
甜味超标 2021-02-07 15:00

I have a little problem with the creation of a table (for a database) in Java.

Currently, I\'m using IntelliJ IDEA and when I write the code for creating a table the tex

相关标签:
3条回答
  • 2021-02-07 15:36

    This warning indicates that you have not configured data source in Database Tool Window in Intellij Idea. It doesn't mean that your code is wrong, it just shows that you don't have code completion based on your database schema.

    Configuration of datasource in Intellij is described here https://www.jetbrains.com/help/idea/database-tool-window.html

    0 讨论(0)
  • 2021-02-07 15:37

    I think you should check the connection to your database.

    url - a database url of the form jdbc:subprotocol:subname
    

    Check the Api https://docs.oracle.com/javase/7/docs/api/java/sql/DriverManager.html#getConnection(java.lang.String)

    Did you add the ODBC correct?

    0 讨论(0)
  • 2021-02-07 15:41

    The message:

    No data sources are configured to run this SQL and provide advanced code assistance.`

    is a little explicit and IMHO a little unnecessary, because I really think that I don't need to configure a database for every project in which we have some SQL queries.

    To handle this message, you have two options:

    1. Configure a Data Source to your project, using the ALT + ENTER above the message and using the option Configure a Data Source:

    or

    1. Disable this SQL dialect detection inspection on the Inspection options on the IDE settings:

    You may need to disable as well No data sources configured inspection on:

    Inspections -> SQL -> No data sources configured

    The second option is the best approach for me unless you really want or need a Data Source in your project.

    0 讨论(0)
提交回复
热议问题