Solved

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

Posted on 2004-09-13
7
234 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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how to see all occupied ports on windows 10 laptop 15 76
iterator/ListIterator approach 17 39
Eclipse Help Java EE 5,6,7 Documentation, why not Java EE 8 8 30
jsp error 6 26
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…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

860 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