Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8886943
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:41:03+00:00 2026-06-14T21:41:03+00:00

We are making simple java project. program will be a standalone . I have

  • 0

We are making simple java project. program will be a standalone .
I have searched but I could not find any sample source code for how to take registration.

I want to use Mysql as a database I connect my project to database .
Now what will I do is there any sample source code for taking registration and using this information as log in information.
note : I don’t know anything about Mysql I am trying to learn for finishing the project.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T21:41:04+00:00Added an answer on June 14, 2026 at 9:41 pm

    Follow the steps:
    1. Download Mysql and Install+ dwnload mysql-connector jar file.
    2. in the mysql(u can connect using mysql command line client) provide ur pwd and get ready.
    Put below code:
    3. create database TEST
    4. use TEST.
    5. CREATE TABLE USER_DTLS (USERNAME VARCHAR2(100), PASS VARCHAR2(100)); creating tables
    6. INSERT INTO USER_DTLS('user1', 'user1234');INSERT INTO USER_DTLS('user2', 'user1234'); creating users
    7. To connect to mysql:

    public Connection getConnection(){
        Connection con=null;
        String url = "jdbc:mysql://localhost:3306/";
        String dbName = "TEST";
        String driver = "com.mysql.jdbc.Driver";
        String userName = "root"; 
        String password = "password";
    
        try {
            Class.forName(driver).newInstance();
            con = DriverManager.getConnection(url+dbName,userName,password);
            System.out.println("CONNECTION ESTABLISHED.");
    
        } catch (Exception e) {
            System.out.println("CONNECTION COULD NOT BE ESTABLISHED.");
            e.printStackTrace();
        }
    
        return con;
    
    }
    

    in JAVA:

    Connection conn=getConnection();
    PreparedStatement pst=conn.prepareStatement("select * from user_dtls where USERNAME =? and PASS=?");
    pst.setString(username,1);
    pst.setString(passwrd,2);
    rs=pst.executeQuery();
    if(rs.next()){
    // HE is valid user
    }else{
    // INVALID
    }
    

    Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making a simple program in Java. Given a set of letters it'll list
I'm making a pretty simple java-program and I get the following error (where n
I am making a simple telnet implementation in Java from ground up. I have
So I am making a simple java project to play around with JDBC in
I'm making a simple drawing app on Android. I'm using the FingerPaint.java provided with
I am also new to Java and Android Development, been making a simple game
I'm making a very simple 2D RPG in Java. My goal is to do
Let's say I'm making a fairly simple web application using JAVA EE specs (I've
I have gone though the JBehave official docs and have started making a sample
I'm making a proof-of-concept game in Java and decided (for practice but mostly for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.