I m using ms access as database and i want to create a login page in java

hye frnz... plz help me m new to java
m using ms access as database and try to create a login page where user type username and pw
i had enter valid user entries in database i checked connectivity is working i want as user login the main window must open after checking username and pw field to database but
now there is an error class not found exception sun:jdbc...... error
plz help me i had stuck frm 4 days */
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.Statement;
import java.sql.ResultSet;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class Login extends JFrame
//Component Declarations
JLabel jlb1,jlb2;
     JTextField jtf1;
     JPasswordField jpf1;
     JButton jb1,jb2;
     //Constructor
     Login()
     //frame settings
          setTitle("Login Dialog");
          setLayout(new GridBagLayout());
          GridBagConstraints gbc = new GridBagConstraints();
          setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
          Dimension d= Toolkit.getDefaultToolkit().getScreenSize();
          setBounds(d.width/2-175,d.height/2-100,350,200);
          gbc.insets=new Insets(7,7,7,7);
     //adding components
          jlb1=new JLabel("User ID");
          gbc.gridx=0;
          gbc.gridy=0;
          add(jlb1,gbc);
          jlb2=new JLabel("Password");
          gbc.gridx=0;
          gbc.gridy=1;
          add(jlb2,gbc);
          jtf1=new JTextField(10);
          gbc.gridx=1;
          gbc.gridy=0;
          add(jtf1,gbc);
          jpf1=new JPasswordField(10);
          gbc.gridx=1;
          gbc.gridy=1;
          add(jpf1,gbc);
          jb1=new JButton("Login");
          gbc.gridx=0;
          gbc.gridy=2;
          add(jb1,gbc);
          jb1.addActionListener(new ActionListener()
               public void actionPerformed(ActionEvent ae)
               Connection conn=null;
                    Statement stmt=null;
                    boolean found=false;
               try
                         Class.forName("sun.jdbc.driver.JdbcOdbcDriver");
                         String dataSourceName = "Inventory";
                         String dbURL = "jdbc:odbc:" + dataSourceName;
                         conn=DriverManager.getConnection(dbURL, "","");
                         stmt=conn.createStatement();
                         ResultSet rst=stmt.executeQuery("Select * from User");
                         System.out.println(jtf1.getText()+"/t"+jpf1.getPassword());
                         while(rst.next())
                              System.out.println( rst.getString(1) +"/t"+ rst.getString(2));
          if(jtf1.getText().equals(rst.getString(1).trim()) && new String(jpf1.getPassword()).equals(rst.getString(2).trim()))
                                   found=true;
                                   rst.close();
                                   dispose();
                                   MainWindow mw= new MainWindow();     /*created min window object created to be opend after login but not working*/     
                                   break;
                         rst.close();
                         stmt.close();
                         conn.close();                    
                    catch(ClassNotFoundException e){System.out.print(e);}
                    catch(Exception e){System.out.print(e);}
                    if(found==false) /*this portion is executing and dialog box appears invalid name and pw with class not found exception sun:jdbc.......on console */
                         JOptionPane.showMessageDialog(null,"Invalid username or password",
                              "Error Message",JOptionPane.ERROR_MESSAGE);
          jb2=new JButton("Clear");
          gbc.gridx=1;
          gbc.gridy=2;
          add(jb2,gbc);
          jb2.addActionListener(new ActionListener()
               public void actionPerformed(ActionEvent ae)
                    jtf1.setText("");
                    jpf1.setText("");
                    jtf1.requestFocus();
          setSize(350,200);
          setVisible(true);
          jtf1.requestFocus();
     public static void main(String args[])
Login l=new Login();
}

http://forums.oracle.com/forums/ann.jspa?annID=599
Oh, and by the way, your keyboard seems to be broken as your words are not getting spelled correctly.

Similar Messages

  • Plz help using ms access as database,i want to create a login page in java

    hye frnz... plz help me m new to java
    m using ms access as database and try to create a login page where user type username and pw
    i had enter valid user entries in database i checked connectivity is working i want as user login the main window must open after checking username and pw field to database but
    now there is an error class not found exception sun:jdbc...... error
    plz help me i had stuck frm 4 days */
    import java.sql.DriverManager;
    import java.sql.Connection;
    import java.sql.Statement;
    import java.sql.ResultSet;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    class Login extends JFrame
    //Component Declarations
    JLabel jlb1,jlb2;
         JTextField jtf1;
         JPasswordField jpf1;
         JButton jb1,jb2;
         //Constructor
         Login()
         //frame settings
              setTitle("Login Dialog");
              setLayout(new GridBagLayout());
              GridBagConstraints gbc = new GridBagConstraints();
              setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
              Dimension d= Toolkit.getDefaultToolkit().getScreenSize();
              setBounds(d.width/2-175,d.height/2-100,350,200);
              gbc.insets=new Insets(7,7,7,7);
         //adding components
              jlb1=new JLabel("User ID");
              gbc.gridx=0;
              gbc.gridy=0;
              add(jlb1,gbc);
              jlb2=new JLabel("Password");
              gbc.gridx=0;
              gbc.gridy=1;
              add(jlb2,gbc);
              jtf1=new JTextField(10);
              gbc.gridx=1;
              gbc.gridy=0;
              add(jtf1,gbc);
              jpf1=new JPasswordField(10);
              gbc.gridx=1;
              gbc.gridy=1;
              add(jpf1,gbc);
              jb1=new JButton("Login");
              gbc.gridx=0;
              gbc.gridy=2;
              add(jb1,gbc);
              jb1.addActionListener(new ActionListener()
                   public void actionPerformed(ActionEvent ae)
                   Connection conn=null;
                        Statement stmt=null;
                        boolean found=false;
                   try
                             Class.forName("sun.jdbc.driver.JdbcOdbcDriver");
                             String dataSourceName = "Inventory";
                             String dbURL = "jdbc:odbc:" + dataSourceName;
                             conn=DriverManager.getConnection(dbURL, "","");
                             stmt=conn.createStatement();
                             ResultSet rst=stmt.executeQuery("Select * from User");
                             System.out.println(jtf1.getText()+"/t"+jpf1.getPassword());
                             while(rst.next())
                                  System.out.println( rst.getString(1) +"/t"+ rst.getString(2));
              if(jtf1.getText().equals(rst.getString(1).trim()) && new String(jpf1.getPassword()).equals(rst.getString(2).trim()))
                                       found=true;
                                       rst.close();
                                       dispose();
                                       MainWindow mw= new MainWindow();     /*created min window object created to be opend after login but not working*/     
                                       break;
                             rst.close();
                             stmt.close();
                             conn.close();                    
                        catch(ClassNotFoundException e){System.out.print(e);}
                        catch(Exception e){System.out.print(e);}
                        if(found==false) /*this portion is executing and dialog box appears invalid name and pw with class not found exception sun:jdbc.......on console */
                             JOptionPane.showMessageDialog(null,"Invalid username or password",
                                  "Error Message",JOptionPane.ERROR_MESSAGE);
              jb2=new JButton("Clear");
              gbc.gridx=1;
              gbc.gridy=2;
              add(jb2,gbc);
              jb2.addActionListener(new ActionListener()
                   public void actionPerformed(ActionEvent ae)
                        jtf1.setText("");
                        jpf1.setText("");
                        jtf1.requestFocus();
              setSize(350,200);
              setVisible(true);
              jtf1.requestFocus();
         public static void main(String args[])
    Login l=new Login();
    Edited by: 795772 on Sep 19, 2010 4:44 AM

    795772 wrote:
    hye frnz... plz help me m new to java
    m using ms access as database and try to create a login page where user type username and pw
    i had enter valid user entries in database i checked connectivity is working i want as user login the main window must open after checking username and pw field to database but
    now there is an error class not found exception sun:jdbc...... error
    plz help me i had stuck frm 4 days */
    <snip>The subject of this forum is Oracle databases. How does your problem relate to that subject?
    Two bits of advice:
    1) Make sure you ask questions in a forum related to your problem.
    2) If you want to be taken seriously as a professional, drop the MS IM Speak and use the language of the forum. In this forum it is English, which is successfully used by many people for whom English is far from their native language.

  • How to create a login page for my client and a form so he can add/edit or delete information ?

    I have a real state client and one of the pages is to show all the houses he is selling with their information.
    And he wants to have a login page so that only him have permission to add, edit or delete a house from his web page.
    Also when adding a new house i want to have a form(kinda like craigslist, ebay,amazon) so he can chose type of house,price,adress,  floor, used , new, etc...?
    I hope i was specif enough.
    thanks

    If this was me, I would just create a log in page. Set the users default access level to 0 and then go into the database and set your's to 1. From there, I would have a page that only is accessable to people with a user access level > 0 .
    On this second page, make a table where you can insert picture(s) of the house, as well as information about the house. Have this page insert records into a database.
    Finally, you will have your house listing on a page that is a dynamic table, which populates itself from the database of housing pictures and information.
    It involves some database work, but with the built in functions of Dreamweaver, it is simple. I would suggest however, that you store links to the pictures in your database as opposed to storing the actual picture, but that's more up to you.
    By doing all this, you have made it so at any time, your admin, and only the admin, can log in, upload pictures and information about a listing, and have it go live to the site.

  • Create a login page that does not link to database

    Hi,
    I am really new to muse and would like to seek some help....sorry if any similar questions have been asked.
    I am making a website interface for my assignment, and i need to create a login page,
    how can i make a text box for entering the login ID and the password? and how can i add a login button?
    By the way, this does not have to link to a database, it is just  a template........so the solution using codes may not help i guess

    Hi,
    check this thread Re: Can I create a login/password protection in Muse for a HTML5 page or two?

  • I've uploaded Acrobat XI Pro and it freezes when I'm using it.  I uninstalled and re-installed.  When I login, it says that it is unable to validate the account and has an option to use the trial.  How do I fix this?

    I've uploaded Acrobat XI Pro and it freezes when I'm using it.  I uninstalled and re-installed.  When I login, it says that it is unable to validate the account and has an option to use the trial.  How do I fix this?

    This is an open forum, not Adobe support... you need Adobe staff support to help
    Adobe contact information - http://helpx.adobe.com/contact.html
    -Select your product and what you need help with
    -Click on the blue box "Still need help? Contact us"

  • I use Plaxo for my contacts, and I want it to synch my Outlook contacts with my PC.  So I can't use my iCloud contact synch.  My question: How do I disable my iCloud contact synch feature while still allowing the rest of iCloud (music

    I use Plaxo for my contacts, and I want it to synch my Outlook contacts with my PC.  I got a new HP PC with the (awful) Windows 8.0 operating system, and, to say the least, I miss the good old days.   Plaxo customer support tells me that I can't use my iCloud contact synch because they clash. 
    My question: How do I disable my iCloud contact synch feature while still allowing the rest of iCloud (music, photos) to operate as usual.
    What mysterious steps must I take in order to do this and not cause a complete meltdown in the process?  The meltdown that I fear most is the one that happens between my ears.

    Music is nothing to do with iCloud but Photostream is, so turn off Mail, Contacts and Calendars (in the iCloud Control Panel) and leave everything else on.
    You will lose iCloud Calendars and Mail as well as Contacts, but you can manually re-enable mail (if you use iCloud email)

  • Dear All, I'm using Cisco ASA 5505 Firewall and I want the email alert from my Firewall if the CPU increase more than 70 %. Is it possible, Please help me. Thanks Vijay

    Dear All,
                         I'm using Cisco ASA 5505 Firewall and I want the email alert from my Firewall if the CPU increase more than 70 %. Is it possible, Please help me.
    Thanks
    Vijay

    Hi Vijay,
    If can be done but you need any network management software. I personally dont think you can ask your ask to send mails. ASA can trigger alert to a SNMP configured server which will intern send mail to you 
    HTH,

  • I am webmaster for our church (C of E) in Dorset, UK.   The church has charitable status, and is cash-strapped.  I am searching for the cheapest download package in order to use Photoshop & Dreamweaver - at home and in the Parish Office. This page (https:

    I am webmaster for our church (C of E) in Dorset, UK.   The church has charitable status, and is cash-strapped.  I am searching for the cheapest download package in order to use Photoshop & Dreamweaver - at home and in the Parish Office. This page (https://www.adobe.com/content/dotcom/uk/volume-licensing/non-profit.edu.html) suggests that we are eligible for discount BUT provides no information on pricing for me to present to the PCC for them to authorise purchase.  Any tips?

    You have to contact a reseller and they will fix you up with a plan and verify your eligibility. That's just how it work. when you are eligible, the normal student pricing applies, give or take any extra discounts based on the number of licenses you buy, which would not apply in your case.
    Creative Suite 6
    Mylenium

  • Hi, I'm in china and I want to create or use a VNP in order to use Facebook. Please help, Hi, I'm in china and I want to create or use a VNP in order to use Facebook. Please help

    Hi, I'm in china and I want to create or use a VNP in order to use Facebook. Please help, Hi, I'm in china and I want to create or use a VNP in order to use Facebook. Please help

    Sorry. We can't help you violate the law in your country.

  • Does anyone know if iWork for iOS can be used on both iPhone 4S and iPad 2? If I bought Pages, say, could I use it on both devices? Thanks

    Does anyone know if iWork for iOS can be used on both iPhone 4S and iPad 2? If I bought Pages, say, could I use it on both devices? Thanks

    It is the same version. So the iWork package will work on both, but Siri will only work on the iPhone 4S. So you could dictate on that, and use iCloud to finish the document on your iPad (assuming you have both). Cheers

  • How do you create a login page using dashcode for the iPhone's mobile safari that will transfer you to the next page?

         Hey I have created a login page in Dashcode for a mobile safari app (aka iphone web app) and I am having trouble since I can not find any useful info about multiple pages. I don't want to use a stack layout view because it is only a login page and I need to check with a database to make sure the user's login info is correct. Right now I have it set up so that it loads another iphone web app project once it validates the info.
         The only problem with this is I am having a good bit of trouble trying to pass values from my php code to javascript or html. For some reason calling the javascript inside the php code makes the actual code inside the app not be called and same with the echo statment for the html.
    So I would like to be able to create the app in this way:
    Login page > PHP > MS SQL > PHP > UNKNOWN (if I can't get the javascript or html to output both) > Secure info on the next page
         I believe It would be a lot easier if I had the option for a multiple page but instead I am having to load up an entirely new dashcode project. If anyone knows a better way please let me know. Or if anyone knows a link to good information on passing values from php to javascript, because I couldn't get any of the code I tried to work, I would really appreciate it.

    Addendum to previous reply:
    OK.  This is weird--but I should be used to that, and just grateful that it seems to work (for now).
    What I had done is FTPd some image files to my site using Filezilla, but when I had tried to access them, I was unsuccessful.  I am almost sure that I used the same url (and variations of it) as you suggested, namely,  http://mysite.verizon.net/username/filename , and it either did not work, or gave me the "Page under construction", or, in some cases asked me for my username and password.
    But, when I did it this time, it worked.  So I probably had something off, but I can now do what I want.
    By the way, if you'll permit another question, while on the site-builder site, it said that there was a "Web Photo Manager", and said that "To download the Web Photo Manager: Open the Site Builder application and go to the All My Sites page. Click on the Web Photo Manager link (listed under Advanced Building Tools )."  I can't find it--would you happen to know where it is?
    In any case, thanks a lot for all your help--it solved my problem. 

  • I accidentally cleared all my cookies. Now I get the Japanese home page and I want ONLY the English home page

    I accidentally cleared all my cookies. Now I get the Japanese home page and I want ONLY the English home page. I was on the home page at the time & I copied the address. It is still in my preferences section. but even when I paste it in, I still get the Japanese site. How do I get the English site back, and ensure that I never see the japanese site on my computer ever again?

    Some sites automatically redirect you to a site in the local language.
    There is usually a link on such websites choose a language or go to an international version that allows to chose the language.
    You can click the link at the bottom of the local Google page (www.google.xx.xx) to go to the [http://www.gooogle.com/ncr "Google.com in English"] site.
    You may need to hover that local Google page with the mouse to make extra content appear.
    You can set the Google preferences on the [http://www.google.com/preferences?hl=en Google Search settings] page (link at the top right).
    Such settings are stored in a cookie on your computer that you need to allow: Tools > Options > Privacy > Cookies: "Exceptions" or Tools > Page Info > Permissions.
    * Google.com in English - always '.com': https://addons.mozilla.org/firefox/addon/51000

  • If i have an Apple account with monay in it and i want to creat a new account can i transfer the money from the old account to the new account ?

    if i have an Apple account with monay in it and i want to creat a new account can i transfer the money from the old account to the new account ?

    If the money contains a completely unspent balance from an iTunes gift card, the iTunes Store staff can put that money back onto the card.
    (89393)

  • HT2534 Hey, I'm running iOS 7 and I want to create Apple ID on my iPad without credit card number, there is no as such option of 'none'  over there. What should I do? Plz help

    Hey, I'm running iOS 7 and I want to create Apple ID on my iPad without credit card number, there is no as such option of 'none'  over there. What should I do? Plz help

    How to Get Apps From the App Store Without a Credit Card
    http://ipadhelp.com/ipad-help/how-to-get-free-apps-from-the-app-store-without-a- credit-card/
    Creating an iTunes Store, App Store, iBookstore, and Mac App Store account without a credit card
    http://support.apple.com/kb/ht2534
    If None is not available - On your computer launch iTunes and click "iTunes Store" in the left navigation pane. Click the "down arrow" next to your name at the top right side of the page and click "Account." Enter your username and password and click "View Account" to log into your account information. Next to your Payment Type, click "Edit." Select the "None" button and click "Done." Confirm that your card has been removed by returning to the Apple account information screen. Under Payment Type, it should say that there is no credit card on file.
    iTunes Store Accepted Forms of Payment
    http://support.apple.com/kb/HT5552
     Cheers, Tom

  • There are two iMacs connected through same router in my house but one refuses to login to facebook and other logged in sites. local techies are bemused, I have just reinstalled OSX and still have the problem. Login page recycles and no errors reported.

    There are two iMacs connected through same router in my house but one refuses to login to facebook and other logged in sites. Local techies are bemused, I have just reinstalled OSX and still have the problem. Login page recycles, I get no further and no errors reported. Safari, Opera and Firefox. Deleted cookies and chain but still no action.

    If you have not already done so, read the router's user manual troubleshooting section and/or contact its customer service department/forums. 
    If still having problems, post back w/details of all you have tried to resolve the problems along w/the troubleshooting solutions that the "local techies" had you try.
     

Maybe you are looking for

  • Where is the WiFi card in a 2010 MacBook Pro 15' I5

    So today i had turned on my 2010 MacBook Pro 2.53GHz Intel i5 15', to notice that the wifi bars are no longer there. I suspect there being an issue with the wifi card, but with this unit, i'm confused as to where it is. I have looked around on the in

  • Cisco 2821 - ASA5520 - 3750G help

    I need help Before – working no probs at the moment my router is my dsl  connection and then a point to point link between the router and the  switch with ospf routing. I'm trying to put a routed asa 5520 between my router and switch for added protec

  • Help - white screen only!

    Friends, I'm faceing a totally annoying problem - the G4 worked fine until an hour ago, when I moved it to another room... Now at start the monitor only goes WHITE and... that's it. No restarts, no resets (PRAM, etc.) can help!!! I hear the starting

  • Frustrated and Need Help with AE after new router installed

    My AE worked fine on a previous router that ran through a modem. I now have a 2 Wire Modem-Router combo and cannot get my computer to recognize it. I am running Windows XP. I have plugged the AE base station directly into the router and configured it

  • GETTING COUNTS FOR EACH SSN

    I am doing a report in ORACLE REPORT WRITER. How can I get counts for each SSN. I want to check the last 7 SSNS and if the competence codes are different get a count for them. If the fitness codes are different get a count for them. This is for each