Helo about using passwordfield with database

im new to passwordfield stuff because i use textfield and i can use it very well
my error is
setString(int,java.lang.String) in java.sql.PreparedStatement cannot be applied to (int,char[])
and the second error
symbol : method equals(char[],java.lang.String)
location: class java.util.Arrays
if(uname.equals(result.getString(1)) && Arrays.equals(pass,result.getString(2)))
here is my code
String uname = txtusername.getText();
      char pass[] = txtpassword.getPassword(); // <--- see i use passwordfield and it has a method getpassword()
     if(uname.length() < 1 || pass.length < 1)
     JOptionPane.showMessageDialog(null, "Please enter your username and password");
     else
        try
            Class.forName(driver);
        }//end try
        catch(Exception e)
           JOptionPane.showMessageDialog(null, "Failed to load MySql driver!");
           return;
        }//end catch
        try
            con = mydb.getmyconnection();
            String statement = "Select * from login where username = ? and password = ?";
            PreparedStatement preparedst = mydb.getmyconnection().prepareStatement(statement);
            preparedst.setString(1, txtusername.getText());
            preparedst.setString(2, txtpassword.getPassword()); // <---here i have an error too if i use getpassword but if i use gettext its fine
            ResultSet result = preparedst.executeQuery();
            while(result.next())
             if(uname.equals(result.getString(1)) && Arrays.equals(pass,result.getString(2)))
                JOptionPane.showMessageDialog(null, "Login Successful!");
                inserttable.main(null);
                this.dispose();
              else
                  JOptionPane.showMessageDialog(null, "invalid login");
            preparedst.close();
            con.close();
           catch(SQLException e)
            JOptionPane.showMessageDialog(null, e.getMessage());
     }//end else
}                 but if i use gettext instead of getpassword and i change my code with this it works fine
String uname = txtusername.getText();
      String pass = txtpassword.getText();
     if(txtusername.getText().length() < 1 || txtpassword.getText().length() < 1)
     JOptionPane.showMessageDialog(null, "Please enter your username and password");
     else
        try
            Class.forName(driver);
        }//end try
        catch(Exception e)
           JOptionPane.showMessageDialog(null, "Failed to load MySql driver!");
           return;
        }//end catch
        try
            con = mydb.getmyconnection();
            String statement = "Select * from login where username = ? and password = ?";
            PreparedStatement preparedst = mydb.getmyconnection().prepareStatement(statement);
            preparedst.setString(1, txtusername.getText());
            preparedst.setString(2, txtpassword.getText());
            ResultSet result = preparedst.executeQuery();
            while(result.next())
              if(uname.equals(result.getString(1)) && pass.equals(result.getString(2)))
                JOptionPane.showMessageDialog(null, "Login Successful!");
                inserttable.main(null);
                this.dispose();
              else
                  JOptionPane.showMessageDialog(null, "invalid login");
            preparedst.close();
            con.close();
           catch(SQLException e)
            JOptionPane.showMessageDialog(null, e.getMessage());
     }//end else
}                Edited by: Jaywhy on Mar 18, 2009 8:38 PM

i did that already with .equals method but its not working if i use passwordfield if i enter invalid username and password nothing happened
            while(result.next())
              if(uname.equals(result.getString(1)) && pass.equals(result.getString(2)))
                JOptionPane.showMessageDialog(null, "Login Successful!");
                inserttable.main(null);
                this.dispose();
              else
                  JOptionPane.showMessageDialog(null, "invalid login");
              }nvm i change the code and got the idea of you thank's
Edited by: Jaywhy on Mar 18, 2009 9:39 PM

Similar Messages

  • Using mapviewer with database installation only (moved to db- spatial) ?

    question moved to db->spatial
    using mapviewer with database installation only ?

    You should be able to deploy MapViewer in this OC4J. Take a look on chapter 1 of the MapViewer User's Guide for information about deploying MapViewer in an Oracle application server.
    Joao

  • Using mapviewer with database installation only ?

    using mapviewer with database installation only ?
    i have installed oracle database 11g on windows
    the enterprise manager already relies on the ocj4 ('http://orcl:1158/em')
    if i open 'http://orcl:1158' i get the start page for the appllication server - by clicking on 'manage applications' i come to the enterprise manager start page (i thinked, i can uplaod some ear application file, sinve oc4j is present for the em)
    its possible to install the mapviewer.ear with this database installation only (since the oc4j is present for the em) - or i have to install the oc4j too?
    thx

    You should be able to deploy MapViewer in this OC4J. Take a look on chapter 1 of the MapViewer User's Guide for information about deploying MapViewer in an Oracle application server.
    Joao

  • About using hibernate with mysql

    hi all,
    i have used hibernate with hsqldb(database given by default) and it works fine.but when i tried to use it with mysql then i have encountered a problem
    xception
    org.hibernate.TransactionException: Transaction not successfully started
         org.hibernate.transaction.JDBCTransaction.rollback(JDBCTransaction.java:149)
         events.EventManagerServlet.doGet(EventManagerServlet.java:63)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
    though i have put jar file of mysql in lib directory and changed the driver name in hibernate.cfg.xml.
    can any one place some example illustrating the steps involving.thanx

    Hi smogura,
    Thanks for the message. Ok I did as you told. I believe I went to the right place:
    Resource->JDBC Connection pools. However I wasn't sure how exactly to go about setting connection pools,
    so I went to the web and did a search and I managed to get hold of this
    website:http://www.albeesonline.com/blog/2008/08/06/creating-and-configuring-a-mysql-datasource-in-
    glassfish-application-server/
    I followed from steps 4 onwards. However at step 14, I did not get a sucesfull ping. The values I used are as follows:
    General:
    Name:               MySQL
    Datasource Classname:     com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource
    Resource Type:           javax.sql.ConnectionPoolDataSource
    Advanced Properties:
    databaseName:      ebooking
    ServerName:     GlassFish
    URL          jdbc:mysql://localhost:3306/ebooking
    password          *****
    user:          1234
    I am not sure what is wrong, by the way, I am using Glassfish V3 that comes bundled with netbeans. Any idea what's wrong or missing? Thanks
    regards

  • Question about using Logic with guitar on stage. HELP!

    Hello,
    I'm a guitarist.
    I would need some advises about using Logic in a live situation..
    How do you move from one track to the other using the keyboard?
    Could that action be controlled by some kind of footswitch?
    Also, the REC button has to be always ON to hear the sound or is there another way to set that up?
    I would like to create let's say 6 tracks with plugins for having 6 different guitar sounds.
    Is it very heavy for the CPU?
    I'm using a macbook with 2GB of ram and a firewire FA-66 edirol sound card.
    Would you also recommend to use a preamp?
    Many many thanks for your help!
    Ciao
    Chester
    MacBook, Powerbook 17", iPod 4G, LaCie HD   Mac OS X (10.4.8)  

    Why to jump from one track to another?
    Simply create a folder with all the Channel strip settings and assign two key commands of your choice to navigate forward and backward.
    And yes, you can assign that command to a MIDI controller (or pedal) too.
    About monitoring have a look at the reference manual page 211.
    Before to buy a preamp try using the Hi-Z input from your Edirol.
    Anyway, six tracks with six plugins on each track are not an issue for your macbook.
    cheers
    rob
    Power Mac G4/533 PowerBook 12   Mac OS X (10.4.8)  

  • Need Info about using Strut with WL 7.0

    I want to find out how to use it with WL 7.0. Would anyone give me any info about it? :) Thanks
              

    You could download and deploy "struts-example.war" from apache website.
              [That Struts 1.0.2 I think.]
              ---Nam
              Jordy wrote:
              > I want to find out how to use it with WL 7.0. Would anyone give me any info about it? :) Thanks
              And God said
              Let there be numbers
              And there were numbers.
              Odd and even created he them,
              He said to them be fruitful and multiply,
              And he commanded them to keep the laws of induction.
              [Bill Taylor [email protected]]
              [nam_nguyen.vcf]
              

  • I want to create a login form by using servlets with database validation.

    Would you please provide me a code for a login form using servlets with Ms Access database validation?

    No. This is not a free coding service. Your request is (a) ridiculous, (b) offensive, and (c) off-topic. Locking this thread for later deletion.

  • Is there a detailed tutorial about using Subversion with JDeveloper?

    Hi,
    My project is currently in my single-user repository, and I have checked out, modified, and checked in my files. All that works fine, but there is much more functionality available. At the moment, I am going through some YouTube videos by Stuart Fleming, but I was hoping that someone might suggest an article that I could keep as a searchable reference.
    Thanks.
    James

    Hi Timo,
    Using Subversion with JDeveloper is the only way I use it. Would you explain what you mean below?
    You just need a couple of method which are not dependant on jdev.
    Thanks.
    James

  • Question about using RE1000 with EA6500

    I have an EA6500 route but having problem getting wireless signal to one room in my house.  As a result, I am thinking about buying RE1000.
    If I buy this unit, will I need to connect to a different network when using wireless devices in the room near the extender.
    Or will both the extender and router operate as a single wireless network name?  If they both operate under a single wireless name, how will I know the extender is connecting and working.
    Please let me know.  Thanks.

    atomarchio wrote:
    I have an EA6500 route but having problem getting wireless signal to one room in my house.  As a result, I am thinking about buying RE1000.
    If I buy this unit, will I need to connect to a different network when using wireless devices in the room near the extender.
    Or will both the extender and router operate as a single wireless network name?  If they both operate under a single wireless name, how will I know the extender is connecting and working.
    Please let me know.  Thanks.
    Just to answer your question, RE1000 will extend your router's main wireless network - so they will operate with single / same wireless network name. You'll know that the extender is connected and working if you'll be able to see the RE1000 listed on your router's DHCP client's table.
    If everyone needs to believe in something, I believe I'll have another beer..

  • How to use JTable with DataBase

    Dear All,
    how can i show a table in a frame that containes a data from a database, then can edit , add and delete some records in the database
    thnx 4 all

    Hi
    I've used below codes for fetching data in JTable.
    try{
               DataRequest = Db.createStatement();
               Results = DataRequest.executeQuery("SELECT * FROM Employee");
               rm = Results.getMetaData();
               col = rm.getColumnCount();  //getColumnCount and store it in integer variable col;
               Vector colNames = new Vector();
               for (int i = 1; i<= col; i++){
                 colNames.addElement(rm.getColumnName(i));
               while(Results.next()){
                    Vector row = new Vector();
                   for(int i = 1; i <= col; i++){
                       row.addElement(Results.getObject(i));
                   data.addElement(row);
               jDataTable.setModel(new DefaultTableModel(data,colNames));
               jDataTable.revalidate();
               Results.close();
            catch (SQLException sql){
                JOptionPane.showMessageDialog(this, "Cannot connect to Database"+sql,"Error", JOptionPane.WARNING_MESSAGE);
            }Hope you satisfied with this code.

  • Question about using aliases with ASM

    Hi ALL,
    Recently I get using ASM  at test database and I have a question regarding how I can use ALIAS feature :
    I've created alias for one of database file:
    SQL> alter diskgroup DATA add alias '+DATA/test1/datafile/app_data_01.dbf' for '+DATA/test1/datafile/app_data.266.824722429';
    I've tried to see it in v$datafile but unsuccessful:
    SQL> select name from v$datafile where name like '%app_data_01%';
    no rows selected
    Try  use to see in in dba_data_files, unsucessful again:
    SQL> select file_name from dba_data_files  where file_name  like '%app_data_01%';
    no rows selected
    I've tried to use created alias , but unsucessfull again:
    SQL> alter database datafile '+DATA/test1/datafile/app_data_01.dbf' resize 12M;
    alter database datafile '+DATA/test1/datafile/app_data_01.dbf' resize 12M
    ERROR at line 1:
    ORA-01516: nonexistent log file, data file, or temporary file "+DATA/test1/datafile/app_data_01.dbf"
    Could someone, please, clarify how I can use aliases created for files in ASM ?

    Hi ,
    Is there any specific reason for adding alias.
    I would suggest to keep name with physical format .
    Because, this will allow us to identify which file_number of ASM level related to which tablespace at database level.
    Like ,
    +DATA/test1/datafile/app_data.266.824722429
    file_number 266 of ASM of diskgroup DATA  is related to app_data tablespace of database test1.
    Regards,
    Aritra

  • Question about using calendar with Microsoft Exchange

    I just recently bought the iPhone5.  I used to have a Droid so I am new to the iPhone altogether.  I have a 3rd generation iPad as well.  I've always used my google calendar on my droid to set up appointments and whatnot on my calendar and I send the invites to my husband so we can sync our calendars.  He would then accept or decline and I would get an email notification saying when he did so.  Now that I am using the iPad and iPhone calendar, I am super confused.  There are so many color coded calendars.  I set up the Microsoft Exchange account on both mine and my husbands phone and I set the default calendar to the Gmail Exchange calendar as someone told me to do.  I'm very confused by what this is all about and my husband still isn't getting the invitations when I send it to his gmail.  However, when I sent it to his aol email address, he did receive an invite but on my calendar it is still showing as "no response".  Also, now we are getting emails in 2 different gmail inboxes, one for the exchange and one for just gmail.  What's the difference?  Can anyone shed some light on this for me?  I'm such a newbie and googling isn't helping!
    Thanks!!!!

    Why to jump from one track to another?
    Simply create a folder with all the Channel strip settings and assign two key commands of your choice to navigate forward and backward.
    And yes, you can assign that command to a MIDI controller (or pedal) too.
    About monitoring have a look at the reference manual page 211.
    Before to buy a preamp try using the Hi-Z input from your Edirol.
    Anyway, six tracks with six plugins on each track are not an issue for your macbook.
    cheers
    rob
    Power Mac G4/533 PowerBook 12   Mac OS X (10.4.8)  

  • Reading a windows file using UTL_FILE with database on linux

    Database: 9.2 on RH AS 2.1 Linux
    I have an application which is running on a windows PC which reads the files on different PC's on the windows network and processes the data and deletes the files. I am thinking of moving the application to the database to reduce a point of failure for our application.
    Has any one tried using UTL_FILE to access the files on the Windows Network using SAMBA ??? Are there any limitations in Oracle on Linux with regards to accessing Samba Mounts' ??
    Thanks in advance
    Purush

    Purush, you should really ask this question in the Database Forums instead of here in the Forms Forum.
    Regards,
    Martin Malmstrom

  • Support about using PL with Adapter (WebService)

    Hi,
    My Name is Antonio Cejudo, i have a problem with PL execution through an adapter because when a test run, the adapter try to do commit and PL too. The adapter send the next message:
    The selected operation execute could not be invoked
    An Exception ocurred while invoking the webservice opration. Please see logs for more details
    Hide Additional Trace Information
    Java.lang.Exception:
    oracle.sysman.emSDK.webservices.wsdlapi.SOAPTestException:Se ha producido
    una excepcion al llamar al enlace de JCA: ""JCA Binding execute of Reference
    operation 'PLTaar08Individualiza' failed due to :Error  de llamada al procedimiento
    almacenado. Error al intentar preparar y ejecutar el API
    DBO.PKG_TRASP_INDIVRECEPTORA.PRC_PROCESA. Se ha producido un error al preparar y ejecutar la API
    DBO.PKG_TRASP_INDIVRECEPTORA.PRC_PROCESA. Causa: java.sqlException: ORA-04068: se ha anulado el estado
    existente de los paquetes ORA-04061: el estado existente del package body
    *"DBO.PKG_TRASP_INDIVRECEPTORA" ha sido invalidado ORA-04065: package body*
    *"DBO.PKG_TRASP_INDIVRECEPTORA" no se ha ejecutado por que se ha modificado o borrado ORA-06508: PL/SQL:*
    no se ha encontrado la unidad de programa llamada: "DBO.PKG_TRASP_INDIVRECEPTORA" ORA-06512: en linea
    *1 Asegurese de que la API esta definida e la base de datos y que los parametros coinciden la firma de*
    la API. Esta excepcion se considera no recuperable debido a un error de modelado. Para clasificarlo
    como recuperable en su lugar ,agregue la propíedad nonRetriableErrorCodes con el valor "-4068"
    al descriptor de despliegue (es decir, weblogic -ra.xml)
    I found that if i use next instruction in the PL, the message stop showing, but the execution of the PL is not stable (Sometimes ok sometimes not ok):
    PRAGMA AUTONOMOUS_TRANSACTION
    The Question is, Are there some way to setup the adapter to avoid the execution of the adapter’s commit ??
    Thank for your help

    I suggest you look at the error code to see what is the problem. Ex
    http://oraclequirks.blogspot.com/2007/03/ora-04061-existing-state-of-package-has.html
    If you do not sant commit, throwing an exception can help.

  • Question About Using iPhoto With Sony Wireless Auto Import

    I just bought a Sony DSC-RX100M2 and I'm very excited about the prospect of sending my photos wirelessly to my Retina MacBook Pro OSX 10.9.1.
    I use iPhoto but I just know the basics.
    I just imported 2 test pictures.
    I can find them in Finder: My Home folder has a folder called Pictures.  Sony placed a folder there called 2-14-14 (i.e. today's date), and the two pictures were in that folder. 
    I opened iPhoto and imported those pictures into my photo library.  Great.
    Now the question.  Once these pictures have been imported into my photo library, can I delete the 2-14-14 folder (and its contents) created by the Sony import?  It seems that I can, and the pictures are still in my photo library.  But if that is the case, where are the pictures?
    Mind you, I don't really need to "know" where the files are.  I just need to be assured that after I import a photo into the photo library, I can delete the original folder where the import came in from my camera (which I think I've just proven to myself that I can?).
    I'm sorry, this is probably basic stuff for most iphoto users, but I just want to make sure that I do not accidentally trash any photos.
    Thanks

    Now the question.  Once these pictures have been imported into my photo library, can I delete the 2-14-14 folder (and its contents) created by the Sony import? 
    Yes
    It seems that I can, and the pictures are still in my photo library.  But if that is the case, where are the pictures?
    As you said - in your iPhoto library
    see the user tip on accessing your iPhoto files for details on accessing them
    LN

Maybe you are looking for

  • How do I pass a username form variable from a drop down list/menu to another page?

    Hi, I have a login_success.php page that has a drop down list/menu (which lists usernames). I want the user to click on their user name, and when they click the submit button the username information to be passed over to the username.php page which w

  • Macbook projector problems

    I'm having some issues with my Macbook being run through a Dell 3200MP DLP projector. Until today, the MB seemed to recognize the Dell projector, but the projector's display would repeatedly show "searching for signal". As of today, the MB doesn't ev

  • When iTunes closes I get " iTunes has Stopped Working message"?

    iTunes works and runs fine on my Vista Ultimate system, however, every time I close iTunes I get a message stating that iTunes has stopped working. I havn't noticed any functionality loss, it's just that the dialog box is annoying. I just did a recen

  • Marks underneath screen of Lumia 820

    Ive had my NNokia Lumia 820 approx 4-5 weeks and though Ive got no software problems with the phone, about a week ago, I noticed what looked like smudge marks on the underneath of the screen, at the top under the speaker and in the bottom left corner

  • Songs from ipod shuffle to itunes

    Have a bunch of songs on my shuffle and for some reason, these songs have disappeared from itunes on home computer.  I thought it would be easy to simply plug in shuffle, drag songs over and then re-create my library in itunes.  Itunes recognizes the