i get the error while connecting my jdbc program to the oracle from last 3 days i tries to solve this problem using the online solution which i got from the google but it cant solve my problem this is my code for sqlplus connection
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class Main{
public static void main(String args[]){
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:ex","system","12345");
System.out.println(con.toString());
}catch(Exception e){
if(e instanceof SQLException){
e.printStackTrace();
}
System.out.println(e.toString());
}
}
}
error that i got while compile the from with the command prompt and my listener.ora file is look like this
my oracle version is Version 11.2.0.2.0
my jdbc driver version is ojdbc6-11.2.0.2.0
this is my listener.log file while i compile the program with the command prompt
Wed Jan 27 08:40:20 2016
27-JAN-2016 08:40:20 * (CONNECT_DATA=(SID=ex)(CID=(PROGRAM=JDBC Thin Client)(HOST=__jdbc__)(USER=Jagdish))) * (ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=52366)) * establish * ex * 12505
TNS-12505: TNS:listener does not currently know of SID given in connect descriptor
Wed Jan 27 08:40:32 2016
27-JAN-2016 08:40:32 * service_update * xe * 0
Wed Jan 27 08:41:34 2016
27-JAN-2016 08:41:34 * service_update * CLRExtProc * 0
27-JAN-2016 08:41:36 * service_update * xe * 0
Wed Jan 27 08:43:23 2016
27-JAN-2016 08:43:23 * service_update * CLRExtProc * 0
Wed Jan 27 08:45:11 2016
27-JAN-2016 08:45:11 * service_update * CLRExtProc * 0
Wed Jan 27 08:46:57 2016
27-JAN-2016 08:46:57 * service_update * CLRExtProc * 0
Wed Jan 27 08:48:44 2016
27-JAN-2016 08:48:44 * service_update * CLRExtProc * 0
Wed Jan 27 08:50:30 2016
27-JAN-2016 08:50:30 * service_update * xe * 0
27-JAN-2016 08:50:31 * service_update * CLRExtProc * 0
Wed Jan 27 08:51:30 2016
27-JAN-2016 08:51:30 * service_update * xe * 0
27-JAN-2016 08:51:36 * service_update * xe * 0
Wed Jan 27 08:52:18 2016
27-JAN-2016 08:52:18 * service_update * CLRExtProc * 0
Wed Jan 27 08:54:05 2016
27-JAN-2016 08:54:05 * service_update * CLRExtProc * 0
Wed Jan 27 08:55:01 2016
27-JAN-2016 08:55:01 * service_update * xe * 0
Wed Jan 27 08:55:31 2016
27-JAN-2016 08:55:31 * service_update * xe * 0
Wed Jan 27 08:55:52 2016
27-JAN-2016 08:55:52 * service_update * CLRExtProc * 0
Wed Jan 27 08:57:41 2016
27-JAN-2016 08:57:41 * service_update * CLRExtProc * 0
Wed Jan 27 08:59:28 2016
27-JAN-2016 08:59:28 * service_update * CLRExtProc * 0
Wed Jan 27 09:01:16 2016
27-JAN-2016 09:01:16 * service_update * CLRExtProc * 0
Wed Jan 27 09:01:37 2016
27-JAN-2016 09:01:37 * service_update * xe * 0
Wed Jan 27 09:03:03 2016
27-JAN-2016 09:03:03 * service_update * CLRExtProc * 0
Wed Jan 27 09:03:27 2016
27-JAN-2016 09:03:27 * (CONNECT_DATA=(SID=ex)(CID=(PROGRAM=JDBC Thin Client)(HOST=__jdbc__)(USER=Jagdish))) * (ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=52658)) * establish * ex * 12505
TNS-12505: TNS:listener does not currently know of SID given in connect descriptor
and i tried to solve this error usin the following link which i found while googler
solution which is from the stackoverflow
another solution which i got from the stackoverflow
but finally all and all my work i cant able to resolve this problem please if anyone know the soltion the please give the solution it's to usefull for me please and thanks in advance.....hope to get answer