title: Connecting to OrientDB server using Java restful HTTP
body: <p>I'm running an OrientDB server on my local machine, and so far the only database I have is the GratefulDead one. I'm trying to connect to the server using this tutorial: <a href="https://github.com/orientechnologies/orientdb/wiki/OrientDB-REST" rel="nofollow">https://github.com/orientechnologies/orientdb/wiki/OrientDB-REST</a></p>
  
  <p>However, I always get a 204 HTTP code, even though the tutorial says I should be getting a 200 http code.</p>
  
  <pre><code>public void getConnection() throws MalformedURLException {
      BufferedReader rd;
      String line;
      Authenticator.setDefault( new Authenticator(){
           protected PasswordAuthentication getPasswordAuthentication(){
              return new PasswordAuthentication("admin", "admin".toCharArray());
          }
      });
      URL url = new URL("http://localhost:2480/connect/GratefulDeadConcerts");
      HttpURLConnection connection = null;
      try {
          connection = (HttpURLConnection) url.openConnection();
          connection.setRequestMethod("GET");
          Map&lt;String, List&lt;String&gt;&gt; map = connection.getHeaderFields();
          for (Map.Entry&lt;String, List&lt;String&gt;&gt; entry : map.entrySet()) {
              System.out.println("Key : " + entry.getKey() +  " ,Value : " + entry.getValue());
          }
          rd = new BufferedReader(new InputStreamReader(connection.getInputStream()));
          while ((line = rd.readLine()) != null) {
              System.out.println("Hello " + line);
          }
          rd.close();
      } catch (IOException e) {
          e.printStackTrace();
      } catch (Exception e) {
          e.printStackTrace();
      }
  }
  </code></pre>