Hi I am new to java when I tried to connect oracle with my java sample code I got the above exception
My Code is
import java.sql.*;
import java.io.IO
This is occur due to wrong connectivity with database connection.
In your program you write
Connection con = DriverManager.getConnection
("jdbc:oracle:thin:@localhost:8080:orcl", "system","tiger");
Go to D:\app\Administrator\product\11.2.0\dbhome_1\NETWORK\ADMIN\tnsnames.ora
Here you find the file like this:
**abcd** =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = **1521**))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = abcd)
)
)
Now you write your connection as follow:
("jdbc:oracle:thin:@localhost:1521:abcd","your_db_name","your_password")
After this you don't get the exception.