• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

java.sql.SQLException: [Oracle][ODBC][Ora]ORA-01017: invalid username/password; logon denied

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 3837
66
Netbeans IDE Oracle Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't use ODBC, if you're connecting to Oracle database. Use Oracle's type 4 JDBC driver (this page has a word or two on Oracle's drivers).

Can you verify using sqlplus that the password and username is correct? If you can, it is possible that the ODBC data source actually points to another database that you think it does.
 
lalit khera
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Martin Vajsar wrote:Don't use ODBC, if you're connecting to Oracle database. Use Oracle's type 4 JDBC driver (this page has a word or two on Oracle's drivers).

Can you verify using sqlplus that the password and username is correct? If you can, it is possible that the ODBC data source actually points to another database that you think it does.



Hi martin , that problem was resolved.
Actually i have used sql developer for creating and maintaining my database named siva.
I have also used the same name for connection name, username, password.
But strangely the user siva that i have created using sql developer is not reflecting in the Oracle EM.
I dont know why, but once i re-create the user and the schema using Oracle EM, everything becomes fine.
Could you help me by providing few good links/tutorials where i can learn these oracle jdbc issues.
Do i need to use commit for reflecting the username that i have created using SQL developer to the oracle EM??

thnks
 
reply
    Bookmark Topic Watch Topic
  • New Topic