title: Connect a JDBC Java Client to SQL Developer on localhost
body: <p>I dont know how to connect my Java Client with JDBC to my SQL Developer Database on localhost with the 1521 port. My SQL Developer is running.</p>
  
  <p>Im sure about username and password - but I think my connstring is set incorrectly. I treid to use it like the usage in the oracle docs. But I always get an error in my OracleDriver catch block. And Im also wondering how I can hand over the name of my Database to the driver, which is "GremienDatenbank".</p>
  
  <p><strong>Here is my code:</strong></p>
  
  <pre><code>package com.company;
  import java.io.BufferedReader;
  import java.io.IOException;
  import java.io.InputStreamReader;
  import java.sql.*;
  
  public class Main {
  
  public static void main(String[] args) {
  
      try{
  
      InputStreamReader isr = new InputStreamReader(System.in);
      BufferedReader br = new BufferedReader(isr);
  
      String connstring ="jdbc:oracle:thin:@localhost:1521/xe";
  
      System.out.println("Username");
      String user = br.readLine();
      System.out.println("Passwort");
      String pwd = br.readLine();
  
      Class.forName("oracle.jdbc.OracleDriver");
  
      Connection connection = DriverManager.getConnection(connstring,user,pwd);
  
  
      } catch (IOException ioe){
  
          ioe.printStackTrace();
  
      } catch (ClassNotFoundException cnfe) {
  
          System.out.println("Fehler: " + cnfe.getMessage());
  
      } catch (SQLException se) {
  
              se.printStackTrace();
  
          }
      }
  }
  </code></pre>
  
  <p>Thanks in advance!</p>