PSQLException:数据库不存在Slick

时间:2017-11-12 08:45:36

标签: postgresql intellij-idea slick intellij-14

我正在学习Slick,我试图在我的Intellij IDEA项目中连接到PostgreSQL数据库。我在Ubuntu 14.04上运行它,如果它是相关的。每次运行我的应用程序时,我都会遇到异常: org.postgresql.Driver connect 严重:连接错误: org.postgresql.util.PSQLException:致命:数据库"歌曲"不存在

所以这是我的代码:

scalaxdb = {
  dataSourceClass = "slick.jdbc.DatabaseUrlDataSource"
  properties = {
    driver = "org.postgresql.Driver"
    url = "jdbc:postgresql://localhost/songs?user=user&password=password"
  }
}

application.conf文件:

name := "slick-test"

version := "0.1"

scalaVersion := "2.12.4"

libraryDependencies += "com.typesafe.slick" %% "slick" % "3.2.1"
libraryDependencies += "org.slf4j" % "slf4j-nop" % "1.7.25"
libraryDependencies += "com.typesafe.slick" %% "slick-hikaricp" % "3.2.1"
libraryDependencies += "org.postgresql" % "postgresql" % "42.1.4"

build.sbt文件:

<html lang="en">
<head>
  <link rel="stylesheet" href="docsupport/style.css">
  <link rel="stylesheet" href="docsupport/prism.css">
  <link rel="stylesheet" href="chosen.css">
  <button id="select-all">Select All</button><br/>
           <select data-placeholder="Chosen Example" multiple class="chosen-select" tabindex="18" id="multiple-label-example">
            <option value="">American Black Bear</option>
            <option>Asiatic Black Bear</option>
            <option selected>Brown Bear</option>
            <option selected>Giant Panda</option>
            <option>Sloth Bear</option>
            <option>Sun Bear</option>
            <option>Polar Bear</option>
            <option>Spectacled Bear</option>
          </select>

  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.js" type="text/javascript"></script>
  <script src="chosen.jquery.js" type="text/javascript"></script>
  <script src="docsupport/prism.js" type="text/javascript" charset="utf-8"></script>
  <script src="docsupport/init.js" type="text/javascript" charset="utf-8"></script>
<script>
$('#select-all').click(function(){
    $('#multiple-label-example option').prop('selected', true); // Selects all options
    $("#multiple-label-example").trigger("chosen:updated");
});
</script>

如果有人帮我找错,我将不胜感激!

1 个答案:

答案 0 :(得分:1)

显然,我创作了我的歌曲&#39;另一个数据库中的关系(不是我试图连接的那个)。这就是它无法连接的原因。现在一切正常!