Solved

Java & Oracle: How do I create a login form in Java?

Posted on 2004-09-13
7
232 Views
Last Modified: 2010-03-31
I've read through old solutions, but my reference to the GUI is a little rusty so I wonder. Would it be possible for someone here to create a form for me? A plain login form, where you type your username and your password and click OK, and get submitted to another form if authenticated. If not authenticated then show error message and log in once more.

Gonna use it on website... So I'll send credits to the one that answers best.

Will be greatly appreciated,
eX.

0
Comment
Question by:Gaute Rønningen
  • 3
  • 2
  • 2
7 Comments
 
LVL 35

Accepted Solution

by:
girionis earned 500 total points
ID: 12042415
0
 

Author Comment

by:Gaute Rønningen
ID: 12042417
By send credits I mean, not in $$$, but in link to website or profile here or whatever chosen...
0
 
LVL 37

Expert Comment

by:zzynx
ID: 12042422
We're here to help you if you have problems with something you wrote on your own.
We're not allowed to write whole bunches of code for you.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 37

Expert Comment

by:zzynx
ID: 12042434
Maybe this can be useful for you: http://javaalmanac.com/egs/java.sql/ConnectOracle.html
0
 

Author Comment

by:Gaute Rønningen
ID: 12042435
Well then...

Here's what I have so far:
import java.sql.*;

public class EnkelDatabaseklient {
    public static void main(String[] args) {
        String driver = "oracle.jdbc.driver.OracleDriver";
        String database = "jdbc:oracle:thin:@oracle.nith.no:1521:STUD";
        String brukernavn = args[0];
        String passord = args[1];
            try {
                  Class.forName(driver);
              Connection forbindelse =
                    DriverManager.getConnection(database, brukernavn, passord);
              Statement setning = forbindelse.createStatement();
              String sporring = "select * from personer";
              ResultSet radsett = setning.executeQuery(sporring);
              while (radsett.next())
                  System.out.println(radsett.getInt("NR") + " " +
                                      radsett.getString("FORNAVN") + " " +
                                      radsett.getString("ETTERNAVN") + " " +
                                      radsett.getString("ADRESSE") + " " +
                                      radsett.getInt("POSTNUMMER") + " " +
                                      radsett.getString("TELEFON"));
              setning.close();
              forbindelse.close();
            }
            catch ( ClassNotFoundException cnfex) {      //koblet til 1)
               System.out.println("Feilet med å laste driveren: " + cnfex.getMessage());
               System.exit(1);
            }
            catch ( SQLException sqlex) {      //koblet til 2) og 3)
               System.out.println("Tilkobling ikke mulig: " + sqlex.getMessage());
               System.exit(1);
            }
    }
}

And I need the GUI part, but I don't remember how to do it...
0
 
LVL 35

Expert Comment

by:girionis
ID: 12042466
Look at the link I posted for the GUI part.
0
 
LVL 35

Expert Comment

by:girionis
ID: 12042620
:)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This video teaches viewers about errors in exception handling.

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now