title: connect oracle database in netbeans
body: <p>i am trying to connect oracle database to netbeans. I followed instruction that given in <a href="https://netbeans.org/kb/docs/ide/oracle-db.html" rel="nofollow">https://netbeans.org/kb/docs/ide/oracle-db.html</a> .
  I fulfilled all the steps that given site.
  but when i try to connect database by using servlet page i got an error. </p>
  
  <p>error is given below,</p>
  
  <blockquote>
    <p>Error Occured : Listener refused the connection with the following error: ORA-12505, TNS:listener does not currently know of SID given in connect descriptor The Connection descriptor used by the client was: localhost:1521:XE [kavindu on KAVINDU]</p>
  </blockquote>
  
  <p>I have no idea, what i next do,</p>
  
  <p>My servlet code is given below,</p>
  
  <pre><code> protected void processRequest(HttpServletRequest request, HttpServletResponse response)
          throws ServletException, IOException {
      response.setContentType("text/html;charset=UTF-8");
      PrintWriter out = response.getWriter();
      String customer_id = request.getParameter("customer_id");
      String f_name = request.getParameter("f_name");
      String l_name = request.getParameter("l_name");
      String mobile_no = request.getParameter("mobile_no");
      String address = request.getParameter("address");
  
   try {
           //loading driver 
  
          Class.forName("oracle.jdbc.driver.OracleDriver");
  
          //creating connection with the database 
          Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE [kavindu on KAVINDU]","kavindu","123456");
  
          PreparedStatement ps = con.prepareStatement("insert into COMPACT_DISK values(?,?,?,?,?)");
  
  
          ps.setString(1, customer_id);
          ps.setString(2, f_name);
          ps.setString(3, l_name);
          ps.setString(4, mobile_no);
          ps.setString(5, address);
          int i = ps.executeUpdate();
  
   if (i &gt; 0) {
              //out.println("Compact disk successfully inserted");
              RequestDispatcher d = request.getRequestDispatcher("new.html");
              d.forward(request, response);
          }
      } catch (ClassNotFoundException | SQLException | ServletException | IOException se) {
          out.println("Error Occured : \n" + se.getLocalizedMessage());
      }
  }
  
   @Override
  protected void doGet(HttpServletRequest request, HttpServletResponse response)
          throws ServletException, IOException {
      processRequest(request, response);
  }
  
    */
  @Override
  protected void doPost(HttpServletRequest request, HttpServletResponse response)
          throws ServletException, IOException {
      processRequest(request, response);
  }
  
  @Override
  public String getServletInfo() {
      return "Short description";
  }// &lt;/editor-fold&gt;
  
  }
  </code></pre>