简体   繁体   English

PredictionIO:在OSX上为PostgreSQL安装JDBC驱动程序

[英]PredictionIO: Installing JDBC driver for postgresql on OSX

I'm trying to follow the PredictionIO tutorial for a text classification enginge provided here. 我正在尝试遵循PredictionIO教程,以获取此处提供的文本分类引擎 I'm using OSX and PredictionIO together with PostgreSQL. 我正在将OSX和PredictionIO与PostgreSQL一起使用。

When trying to import data into my naked App with the command 当尝试使用命令将数据导入到我的裸机中时

pio import --appid 1 --input data/stopwords.json

I get the following error: 我收到以下错误:

Exception in thread "main" java.sql.SQLException: No suitable driver found for jdbc:postgresql://localhost/pio

So obviously the JDBC driver is missing or not linked appropriately. 因此,显然JDBC驱动程序丢失或未正确链接。 Here's where my trouble begins. 这是我的麻烦开始的地方。 Naively I downloaded the postgres jdbc driver from this source . 我天真地从此源下载了postgres jdbc驱动程序。 I read that I need to add it to java's "CLASSPATH", so I tried this by adding 我读到我需要将其添加到Java的“ CLASSPATH”中,因此我尝试通过添加

export CLASSPATH=$CLASSPATH:~/java-extensions/postgresql-9.4.1207.jre6.jar

to my bash configuration. 到我的bash配置。 Unfortunatly this does not work. 不幸的是,这不起作用。 A similar error situation is discussed here - but with my knowledge I'm not able to extract useful hints from it. 这里讨论了类似的错误情况-但据我所知,我无法从中提取有用的提示。

-- -

Version details: 版本详细信息:

psql (PostgreSQL) 9.4.5 installed via homebrew 通过自制软件安装的psql(PostgreSQL)9.4.5

OSX Yosemite OSX优胜美地

PredictionIO 0.9.5 预测IO 0.9.5

pio status reports "Your system is all ready to go." pio status报告“您的系统已准备就绪。”

See this Google Group thread: https://groups.google.com/d/topic/predictionio-user/yJexMh5HpHc/discussion 看到以下Google网上论坛线程: https : //groups.google.com/d/topic/predictionio-user/yJexMh5HpHc/discussion

tl;dr : tl; dr:

Fixed in next release of PredictionIO (v0.9.6), coming soon. 已在即将发布的下一个PredictionIO(v0.9.6)版本中修复。

Workaround for earlier PIO versions : 早期PIO版本的解决方法:

pio train -- --driver-class-path WHEREVER/postgresql-9.4-1204-jdbc41.jar 

As alex9311 pointed out, the pio import nowadays accepts a flag to specify the driver location: 正如alex9311指出的那样,当今的pio import接受一个标志来指定驱动程序位置:

pio import --appid 1 --input data/stopwords.json --driver-class-path WHEREVER/postgresql-9.4-1204-jdbc41.jar 

See also this SO question 另请参阅此问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM