Please a look at this code, i am getting the error.
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
public class InsertRecord {
public static void main(
String[] args) {
String driver="sun.jdbc.odbc.JdbcOdbcDriver";
String cs="jdbc:odbc:siva";
String user = "siva";
String pwd = "siva";
String sqlstmt="INSERT INTO employee VALUES(1,'Steve',5,70)";
Connection con = null;
Statement st = null;
try
{
Class.forName(driver);
}
catch(Exception e)
{
System.out.println(e);
}
System.out.println("Driver loaded");
try
{
con=DriverManager.getConnection(cs,user,pwd);
System.out.println("Connected to the Oracle Database");
st = con.createStatement();//creates a Statement object for sending SQL statements to the database.
int updatecount=st.executeUpdate(sqlstmt);//return either the row count for INSERT, UPDATE or DELETE statements, or 0 for SQL statements that return nothing
System.out.println(updatecount+" row inserted");
}
catch(Exception e)
{
System.out.println(e);
}
try
{
st.close();
con.close();
}
catch(Exception e)
{
System.out.println(e);
}
}//main()
}//class()
output is like:
Driver loaded
java.sql.SQLException: [Oracle][ODBC][Ora]ORA-01017: invalid username/password; logon denied
java.lang.NullPointerException
I am 100% sure that my username and password are siva and siva resp.
please help