Solved

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

Posted on 2004-09-13
7
233 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

770 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