0

I have setup Rethinkdb to use and I am trying to connect to DB via Java program using Java Driver. I downloaded RethinkDB java driver 2.3.1 from http://mvnrepository.com/artifact/com.rethinkdb/rethinkdb-driver/2.3.1.
But I am getting the following compile error in this simple program.
Can you please tell why I am getting this compile error?

//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

Complete program

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);
}
Alex
  • 4,885
  • 3
  • 19
  • 39

1 Answers1

0

You cannot put statements into the class body, you need to move them into a method.

Thilo
  • 257,207
  • 101
  • 511
  • 656