7 Replies Latest reply: Sep 16, 2012 6:33 AM by 962312 RSS

    Invalid Login

    962312
      Hello Everyone :)

      I am new to database. I am having a small problem :)
      import java.sql.*;
      import java.io.*;
      public class Student
      {
           public static void main(String as[])
           {
                Connection con=null;
                ResultSet rs=null;
                Statement st=null;
                String q=null;
                int roll;
                String name,address,gender;long contact;
                try
                {
                     Class.forName("oracle.jdbc.driver.OracleDriver");
                     con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","maverick","miRR98^!");
                     st=con.createStatement();
                     q="select * from Student";
                     rs=st.executeQuery(q);
                     while(rs.next())
                     {
                          roll=rs.getInt("Roll");
                          name=rs.getString("Name");
                          address=rs.getString("Address");
                          gender=rs.getString("Gender");
                          contact=rs.getLong("Contact");
                          System.out.println("Roll : "+roll);
                          System.out.println("Name : "+name);
                          System.out.println("Address : "+address);
                          System.out.println("Gender : "+gender);
                          System.out.println("Contact : "+contact);
                     }
                }
                catch(Exception e)
                {
                     System.out.println(e);
                }
           }
      }
      using the same connection parameters in Oracle 10g(with "saipro","saipro" user/pass) on a windows machine i was able to query.
      but using this code on a Ubuntu based 11g database(with "maverick","miRR98^!") i am unable to do that.

      i can login into localhost:8080/apex using the maverick acnt. and also as admin.

      Error in IDE : "java.sql.SQLException: ORA-01017: invalid username/password; logon denied"

      please help :)

      Thanks ;)
        • 1. Re: Invalid Login
          959674
          you trying to change your password (remove special characters)
          • 2. Re: Invalid Login
            Veeresh.S
                           con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","maverick","miRR98^!");
            through sqlplus change password of maverick but this time without special characters something like mirror

            then replace the old password with your new password in your java code and try executing.

            issue might be with the special characters or you have entered wrong password.
            • 3. Re: Invalid Login
              962312
              import java.sql.*;                                                                                                                
              import java.io.*;                                                                                                                 
              public class Student                                                                                                              
              {                                                                                                                                 
                   public static void main(String as[])                                                                                          
                   {                                                                                                                             
                        Connection con=null;                                                                                                      
                        ResultSet rs=null;                                                                                                        
                        Statement st=null;                                                                                                        
                        String q=null;                                                                                                            
                        int roll;                                                                                                                 
                        String name,address,gender;long contact;                                                                                  
                        try                                                                                                                       
                        {                                                                                                                         
                             Class.forName("oracle.jdbc.driver.OracleDriver");                                                                     
                             con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","maverick","mirror");                           
                             st=con.createStatement();                                                                                             
                             q="select * from Student";                                                                                            
                             rs=st.executeQuery(q);                                                                                                
                             while(rs.next())                                                                                                      
                             {                                                                                                                     
                                  roll=rs.getInt("Roll");                                                                                           
                                  name=rs.getString("Name");                                                                                        
                                  address=rs.getString("Address");                                                                                  
                                  gender=rs.getString("Gender");                                                                                    
                                  contact=rs.getLong("Contact");                                                                                    
                                  System.out.println("Roll : "+roll);                                                                               
                                  System.out.println("Name : "+name);                                                                               
                                  System.out.println("Address : "+address);                                                                         
                                  System.out.println("Gender : "+gender);                                                                           
                                  System.out.println("Contact : "+contact);                                                                         
                             }                                                                                                                     
                        }                                                                                                                         
                        catch(Exception e)                                                                                                        
                        {                                                                                                                         
                             System.out.println(e);                                                                                                
                        }                                                                                                                         
                   }                                                                                                                             
              }                                                                                                                                 
              changed password of maverick to mirror.
              still the same error.
              • 4. Re: Invalid Login
                962312
                ok.. i finally managed to figure out the solution. but not sure what the problem was.
                maverick@Laptop:~$ su - oracle
                Password: 
                oracle@Laptop:~$ sqlplus / as sysdba
                
                SQL*Plus: Release 11.2.0.2.0 Production on Sat Sep 15 22:58:35 2012
                
                Copyright (c) 1982, 2011, Oracle.  All rights reserved.
                
                
                Connected to:
                Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production
                
                SQL> alter user maverick identified by mirror;
                alter user maverick identified by mirror
                           *
                ERROR at line 1:
                ORA-01918: user 'MAVERICK' does not exist
                
                
                SQL> create user maverick identified by mirror;
                
                User created.
                
                SQL> grant create session to maverick;
                
                Grant succeeded.
                
                SQL> 
                i did this. now i can connect to the database. but, another problem is that i do not know where this account has been created. as i cannot access the user in apex. in any of the workspaces(Internal and saipro(userdefined)
                • 5. Re: Invalid Login
                  orafad
                  mahapatrasworoop wrote:
                  i can login into localhost:8080/apex using the maverick acnt. and also as admin.
                  I'm guessing you have mixed up the different types of user. Database user != apex user.

                  For starters, read these:

                  http://docs.oracle.com/cd/E17781_01/admin.112/e18585/toc.htm
                  http://docs.oracle.com/cd/E17781_01/doc.112/e18644/toc.htm

                  Note that there's a separate forum for Apex:
                  Oracle Application Express (APEX)
                  • 6. Re: Invalid Login
                    orafad
                    mahapatrasworoop wrote:
                    ... where this account has been created. as i cannot access the user in apex.
                    View for database users:

                    select * from all_users;


                    Apex dictionary may be described by apex_dictionary:
                    SQL> select apex_view_name,comments
                      2  from apex_dictionary
                      3  where column_id=0
                      4    and apex_view_name like '%USER%';
                    
                    APEX_VIEW_NAME                 COMMENTS
                    ------------------------------ --------------------------------
                    APEX_WORKSPACE_APEX_USERS      Application Express (APEX) users
                    Thusly, apex users may be found querying the view:
                    SQL> select user_name, workspace_name
                      2  from apex_workspace_apex_users
                      3  order by 1,2;
                    
                    USER_NAME  WORKSPACE_NAME
                    ---------- --------------------------
                    ADMIN      INTERNAL
                    HR         HR
                    Another view that shows the connection between Apex workspace and database schema/user is:
                    apex_workspace_schemas

                    Please use the excellent documentation libraries and also search apex forum for common questions and answers.

                    Edited by: orafad on Sep 16, 2012 11:01 AM
                    • 7. Re: Invalid Login
                      962312
                      Thanks for the info :)

                      i was able to understand the difference betn apex user and DB user.