我已经设置Rethinkdb使用,我正在尝试连接到数据库通过Java程序使用Java驱动程序。我从http://mvnrepository.com/artifact/com.rethinkdb/rethinkdb-driver/2.3.1下载了RethinkDB java驱动程序2.3.1。
But I am getting the following compile error in this simple program.
你能告诉我为什么会出现这个编译错误吗?
//Code Line
r.db("test").tableCreate("authors").run(conn);
//Compile error in eclipse
Multiple markers at this line
- Syntax error, insert ")" to complete SingleMemberAnnotation
- Syntax error, insert ")" to complete MethodDeclaration
- Syntax error, insert "Identifier (" to complete
MethodHeaderName
- Syntax error on token ")", delete this token
- Syntax error, insert "SimpleName" to complete QualifiedName
- Syntax error on token ".", @ expected after this token
完整的程序
package com.test;
import com.rethinkdb.RethinkDB;
import com.rethinkdb.gen.exc.ReqlError;
import com.rethinkdb.gen.exc.ReqlQueryLogicError;
import com.rethinkdb.model.MapObject;
import com.rethinkdb.net.Connection;
public class DbConnection {
public static final RethinkDB r = RethinkDB.r;
Connection conn= r.connection().hostname("localhost").port(28015).connect();
r.db("test").tableCreate("authors").run(conn);
}
发布于 2016-06-05 05:15:50
您不能将语句放入类体中,您需要将它们移动到方法中。
https://stackoverflow.com/questions/37638661
复制相似问题