Oracle 10g Exception--Driver issues

public class jdbcdemo {

public static void main(String[] args) {

String name;

int number;

String city;

String query="select * from employee";

try {

Class.forName("oracle.jdbc.OracleDriver");

Connection con = DriverManager.getConnection("jdbc:oracle:oci:@//localhost:1521/employee","scott","tiger");

Statement stmt=con.createStatement();

ResultSet rs=stmt.executeQuery(query);

while (rs.next()) {

name=rs.getString("emp_nm");

number= rs.getInt("emp_no");

city=rs.getString("emp_city");

System.out.println(name + "," + number + "," + city + "\n");

}

con.close();

}catch(ClassNotFoundException e){

e.printStackTrace();

}catch(SQLException e){

e.printStackTrace();

}

}

}

I get this following exception when i try to connect to oracle 10g.Please let me know if i m using the correct DB url..and what needs to be done other than that...

java.sql.SQLException: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor

at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)

at oracle.jdbc.driver.T2CConnection.checkError(T2CConnection.java:672)

at oracle.jdbc.driver.T2CConnection.logon (T2CConnection.java:346)

at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:414)

at oracle.jdbc.driver.T2CConnection.<init>(T2CConnection.java:132)

at oracle.jdbc.driver.T2CDriverExtension.getConnection (T2CDriverExtension.java:78)

at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)

at java.sql.DriverManager.getConnection(DriverManager.java:582)

at java.sql.DriverManager.getConnection (DriverManager.java:185)

at javaapp.jdbcdemo.main(jdbcdemo.java:31)

BUILD SUCCESSFUL (total time: 6 seconds)

[1917 byte] By [profilemia] at [2007-11-27 5:42:33]
# 1

I am not that familiar with different services for ORACLE drivers, but when I try to connect to an ORACLE database, I use 'thin' instead of 'oci'. And also scip the to slashes in front of the machine name.

So instead of

Connection con = DriverManager.getConnection("jdbc:oracle:oci:@//localhost:1521/employee","scott","tiger");

try

Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521/employee","scott","tiger");

g_magossa at 2007-7-12 15:21:19 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2
java.sql.SQLException: ORA-12514: TNS:listener does not currently know of service requested in connect descriptorIs the service name employee specified in the tnsnames.ora file?
dvohra09a at 2007-7-12 15:21:19 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...