
import java.sql.*;
import java.util.*;
public class OJDBCAvi
{
public static void main(String args[])throws Exception
{
String sql="insert into year values(3,'avi1')";
Class c=Class.forName("oracle.jdbc.driver.OracleDriver");
Driver d=(Driver)c.newInstance();
String s="jdbc:oracle:thin:@localhost:1521:ORCL";
Properties p=new Properties();
p.put("user","scott");
p.put("password","tiger");
Connection con=d.connect(s,p);
Statement st=con.createStatement();
st.executeUpdate(sql);
con.close();
System.out.println("table details are saved");
}
}
This is my ODBC program,bt here I am getting error i.e Exception in Thread "main" java.sql.SQLException:Io Exception : The network Adapter could not establish the connection.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.