title: Exception in thread "main" com.rethinkdb.gen.exc.ReqlDriverError: Connection timed out
body: <p>I am using Gridle and using RethinkDB Driver (Java) - 2.2.3 and running in Netbeans (8.2). I am getting this error code:</p>
  
  <pre><code>`Exception in thread "main" com.rethinkdb.gen.exc.ReqlDriverError: Connection timed out.
      at com.rethinkdb.net.SocketWrapper.connect(SocketWrapper.java:91)
      at com.rethinkdb.net.Connection.connect(Connection.java:100)
      at com.rethinkdb.net.Connection.reconnect(Connection.java:94)
      at com.rethinkdb.net.Connection.reconnect(Connection.java:83)
      at com.rethinkdb.net.Connection$Builder.connect(Connection.java:422)
      at org.ap.UserInput.grabInput(UserInput.java:24)
      at org.ap.comsci.main(comsci.java:24)
  Caused by: java.net.ConnectException: Connection timed out: connect
      at java.net.DualStackPlainSocketImpl.connect0(Native Method)
      at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)
      at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
      at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
      at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
      at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
      at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
      at java.net.Socket.connect(Socket.java:589)
      at com.rethinkdb.net.SocketWrapper.connect(SocketWrapper.java:53)
      ... 6 more`
  </code></pre>
  
  <p>Below is the code I am Running that connects to the database. Sorry, I can't seem to fix the insert, therefore I used hastebin, if someone wants to help fix the formating that would be great! (<a href="https://pastebin.com/XPgPqmc5" rel="nofollow noreferrer">https://pastebin.com/XPgPqmc5</a>). Major thanks to the other editor for cleaning it all up! - Java Side Code</p>
  
  <p>EDIT:</p>
  
  <p>UserInput.java</p>
  
  <pre><code>import java.util.Scanner;
  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;
  import static org.ap.Database.r;
  
  public class UserInput {
           public static Double[] grabInput(){
              Connection conn = r.connection().hostname("Private").port(28015).connect();            
                  Scanner scan = new Scanner(System.in);
  
                  //Decide what the scanner will be looking for
                  System.out.print("What action will you be completing?: ");
                  String action = scan.nextLine();
  
                  //Scans For Action Requests
                      if (action.equals("Login")){
                         //Login Action
                              System.out.print("Username: ");
                              String username = scan.nextLine();
                              System.out.print("Password: ");
                              String password = scan.nextLine();
  
                        //Login Validation
  
                        if (r.db("APSCI").table("BankAccounts").filter(row -&gt;
                           row.g("username").eq(username).and(row.g("password").eq(password))).coerceTo("BOOL").run(conn)){
                           System.out.print("Welcome /n (username)");
                        }
                         else {
                             System.out.print("No User Was Found!");
                         }
                      }
  
                      if (action.equals("Numbers")){
                          //Decide the number of numbers to be used in the array
                          System.out.print("Enter how many numbers you will input: ");
                          Integer numOfNumbers = Integer.parseInt(scan.nextLine());
  
                          //Create a string array to store the numbers that will be used
                          Double arrayOfNumbers[] = new Double[numOfNumbers];
                          for (int i = 0; i &lt; arrayOfNumbers.length; i++) {
              System.out.print("Enter the number " + (i+1) + " : ");
                  arrayOfNumbers[i] = Double.parseDouble(scan.nextLine());
                      }
  
                          //Now show your numbers
                          System.out.print("My numbers : ");
                          System.out.print(arrayOfNumbers[0]);
                          for (int i = 1;i &lt; arrayOfNumbers.length;i++) {
                              System.out.print(" , " + arrayOfNumbers[i]);
                          }
                          System.out.println();
  
                          return arrayOfNumbers;
  
  
                      }
               return null;
           }
  }
  </code></pre>