```
import java.util.*;
import java.io.*;
import java.sql.*;
public class Stud
{
    public static void main(String args[])
    {
        try
        {
            Class.forName("oracle.jdbc.driver.OracleDriver");
            System.out.println("Driver Registered");
            Connection connection =DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","bh","1234");
            System.out.println("Connection created");
            PreparedStatement ps=connection.prepareStatement("insert into Student(StudName,dob,math,phy,chem,agg) values(?,?,?,?,?,?)");
            System.out.println("prepare stmt ");
            ps.setString(1,"name");

            ps.setString(2,"dob");
            ps.setInt(3,96);
            ps.setInt(4,96);
            ps.setInt(5,94);
            ps.setDouble(6,96);
            int a=ps.executeUpdate();
            ps.close();
            connection.close();
        }
        catch(Exception ex)
        {
            ex.printStackTrace();
        }
    }
}

```

Error
-----

```
java.sql.sql exception listner refused to connect with the following error
  ora 12505 the listner currently does not know of sid in give connectoin descriptor
  local host 1521

```

I'm using oracle 10 g and I have set the ojdbc14.jar in my class path.
I'm using Java 7 and my tnsname.ora also contain (PORT = 1521))
So I can't understand the given error.