簡體   English   中英

如何在Scala Mac OS中使用postgres JDBC?

[英]How can I get postgres JDBC working in Scala Mac OS?

我正在嘗試做一個教程,使用JDBC驅動程序從scala連接到Postgres

https://mackler.org/LearningSlick2/

但是,我收到此錯誤消息:

[info] Starting scala interpreter...
[info] 
Welcome to Scala version 2.10.3 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_65).
Type in expressions to have them evaluated.
Type :help for more information.

scala>  import org.postgres
<console>:7: error: object postgres is not a member of package org
        import org.postgres

我使用MacOSX,並通過http://postgresapp.com/安裝了postgress

我缺少正確使用jdbc連接的地方?

看來您的postgres jar不在您的課程路徑上。 嘗試:

$ scala -classpath postgres.jar 

其中postgres.jar是假設的示例。

在啟動REPL會話時,您可能需要使用諸如pathToPostGresLib/*.jar類的所有jar。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM