Skip to content

TheITEducation.com

Free Online CS/IT Education, Courses & Tutorials | PPSC Online Test Preparation

  • Blog
  • Job Preparations
    • LECTURER CS PREPARATION (Syllabus,video,quizzed,notes)
    • PPSC Lecturer English Test Preparation for PPSC Lecturer English Jobs 2021-2022
    • Latest Jobs
    • PPSC Tehsildar Preparation Courses
    • Tehsildar Preparation
    • PPSC Junior Clerk Preparation
    • PPSC Download (All Subjects)
  • Edu. News
    • Admissions
    • Examination
    • Results
  • VU Short Lec.
    • CS101 Intro. to Computing
    • CS201 Introduction to Computing
    • CS304 Object oriented Programming
    • CS504 Software Engineering
    • CS619 C#
    • Project Documentation
  • Free Courses
    • Free Courses of The IT Education
    • AIS/ECommerce
    • MS Office Tutorial in URDU
    • BBA-104 Introduction to Psychology
    • HTML5 Canvas
    • WordPress
    • C++ Programming
    • Downloads
      • R&D Analysis
        • Research Abstracts
  • How to Install
    • Compilers
    • DBMS
    • Operating System
    • Programming IDE
    • Windows Utilities
  • MCQs
    • MS Office MCQs
    • Pakistan Affairs MCQ’s
    • 1973 Constitution Part1
    • 1973 Constitution 2
    • Everyday Science MCQs
    • Seerat un Nabi MCQS
    • 150+ GK MCQs
    • TOP100 GK MCQs
    • TOP GK MCQ’s
  • Log in
    • Contact Us
    • About theITeducation.Com Team
 Posted in CS619 C# Sharp Programming, VU Courses

CS619 Test Phase – JAVA Login System with Netbeans and MS SQL Server Spring 2020

 Habibullah Qamar  July 30, 2020
CS619 Test Phase Netbeans and SQL Server Login - Test Phase

CS619 Test Phase – JAVA Login System with Netbeans and MS SQL Server Spring 2020 #CS619 #TestPhase #JAVA. For CS619 Test Phase, login system and user management system assigned to the students of Final year project which are to be made using Java PHP Android ASP and python.

In this video I will demonstrate login system form designing in NetBeans and JAVA application and then will lead to you how to connect with there Microsoft SQL server database with NetBeans and perform query based operation.

Topics of video

  • 1. CS619 Test Phase Spring 2020
  • 2. Java and MS Sql Server Test Phase
  • 3. Netbeans and SQL Server login system
  • 4. How to add controls in Netbeans in JAVA Form
  • 5. How to make GUI forms in JAVA Test Phase

Task Develop an application for Library Management system in Java or PHP language using MySQL server or MS SQL server. You have to design and develop login screen and Admin Functions screen. Login screen will be connected with Database and username, password filed will be verified from Database upon clicking Login button.

If Username and Password do not match the records in the database then it will throw an error message “Invalid User and Password. Try Again” For your convenience sample Screen shots are given below. So, once a user logs in, he or she will be redirected to the admin menu as below. You have to draw the same Admin Function screen and no functionality required against each button in Admin Functions screen.

You should only add a message box against click event of each button showing this statement “Welcome to Library Management System and this is __________ Class Function” ____________ should be filled with either “Users” or “Books” word depending upon which class function it was called.


import java.sql.Connection;
import java.sql.DriverManager;
import javax.swing.JOptionPane;


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Khayoo
 */
public class MyConnection {
    // create a function to connect with mysql database
    
    public static Connection getConnection(){
     
        Connection con = null;
        try {
           //Class.forName("com.mysql.jdbc.Driver");
           //con = DriverManager.getConnection("jdbc:mysql://localhost/java_login_register", "root", "");
            String url = "jdbc:sqlserver://localhost;databaseName=userMgt;integratedSecurity=true";
            Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
            //Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
             con = DriverManager.getConnection(url);
             JOptionPane.showMessageDialog(null, "Connected");
             
            
        } catch (Exception ex) {
            //System.out.println(ex.getMessage());
            JOptionPane.showMessageDialog(null, "not connected");

        }
        
        return con;
    }
    
}

CS619 Test Phase – JAVA Login System with Netbeans and MS SQL Server Spring 2020

Login Form JAVA Code with SQL and Netbeans


import javax.swing.JOptionPane;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Khayoo
 */
public class NewJFrame extends javax.swing.JFrame {

    /**
     * Creates new form NewJFrame
     */
    public NewJFrame() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jTextField1 = new javax.swing.JTextField();
        jTextField2 = new javax.swing.JTextField();
        jButton1 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Login");

        jLabel1.setText("Username");

        jLabel2.setText("Password ");

        jButton1.setText("Login");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(104, 104, 104)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jTextField1)
                    .addComponent(jTextField2, javax.swing.GroupLayout.DEFAULT_SIZE, 153, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(jButton1)
                        .addGap(47, 47, 47)))
                .addContainerGap(102, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(47, 47, 47)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(jButton1)
                .addContainerGap(21, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
//        MyConnection mycon=new MyConnection();
        //mycon.getConnection();
             
              //  JOptionPane.showMessageDialog(null, "Welcome... to GUI");
         
        PreparedStatement ps;
        ResultSet rs;
        
        String username=jTextField1.getText();
        String password=jTextField2.getText();
        
        if (username.length()==0 || password.length()==0)
            JOptionPane.showMessageDialog(null, "Username and password must be enterned");
        else 
        {
        
        String query = "SELECT  COUNT(*) FROM the_app_users WHERE username='"+username+"' AND password='"+password+"'";

        //executing query
        try {
            ps = MyConnection.getConnection().prepareStatement(query);
            //ps.setString(1, username);
            
            //rs = ps.executeQuery();
            rs = ps.executeQuery();
            rs.next();
            int count = rs.getInt(1);
            rs.close();
            if(count<=0)
                JOptionPane.showMessageDialog(null, "Invalid User....");
            else
            {
                JOptionPane.showMessageDialog(null, "Welcome... to Admin Dashboad");
                this.setVisible(false);
                new AdminDash().setVisible(true);
            }
        } catch (SQLException ex) {
            Logger.getLogger(NewJFrame.class.getName()).log(Level.SEVERE, null, ex);
        }
        }
    }//GEN-LAST:event_jButton1ActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new NewJFrame().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JTextField jTextField2;
    // End of variables declaration//GEN-END:variables
}
Post Views: 850

Related

Tagged cs619, cs619 design document, cs619 final presentation, cs619 handouts, cs619 policy, cs619 test phase, cs619 test phase login, cs619 test phase preparation, cs619 test phase viva, cs619 test phase viva questions 2018, cs619 viva questions, pre final viva cs619, testphase cs619 java, virtual university, vulms

Author: Habibullah Qamar

Its me Habib Ullah Qamar working as a Lecturer (Computer Sciences) in Pakistan. I have an MS(M.Phil) degree in computer sciences with specialization in software engineering from Virtual University of Pakistan Lahore. I have an experience of more than 15 years in the filed of Computer Science as a teacher. Blog Writing is my passion. I have many blogs, This one is special made with the aim of providing 100% Free online coaching and training to the students of under-graduate and postgraduate classes. Most of the students enrolled in computer sciences, information technology, software engineering and related disciplines find it difficult to understand core concepts of programming and office automation. They find difficult in understanding and solving their assignments.

Post navigation

Online LIVE Lecture with MS PowerPoint, StreamYard →
← Earn Money online in Pakistan on Fiverr

Search in web

Latest Posts

  • What is meant by sohcahtoa and its purpose?
  • CTI Jobs 2022-2023 Second Phase List of Faisalabad male and Female Division
  • CTI Jobs 2022 / 2023 List of Multan Division Second Phase Male and Female Colleges
  • CTI Jobs 2022 / 2023 List of Rawalpindi Division Male and Female Colleges
  • CTI Jobs 2022-2023 Tentative of Gujranwala Division
  • CTI Jobs 2022 / 2023 List of Lahore Male and Female Lahore Division 2nd phase
  • FPSC ASF Inspector Past Papers | FPSC ASF Inspector Past Papers Pdf
  • ASF Inspector Syllabus 2022 | FPSC ASF Inspector Syllabus 2022

Advertisement

Like us on FB

Like us on FB

Advertisement

Translate

Advertisement

Popular MCQs

  • Solved MCQs on 1973 Constitution
  • 1973 Constitution Mcqs
    • Constitution of Pakistan MCQ’s
  • PPSC Past Papers 2020 pdf
  • Election Commission 2017 Act MCQ’s
  • PPSC Past Paper MCQ’s
  • General Knowledge MCQ’s
  • English Grammar MCQ’s
  • English MCQ’s
  • Pakistan Affairs MCQ’s
  • Computer Science MCQ’s
  • Microsoft Office MCQ’s
  • Every Day Science MCQ’s
  • Islamiat MCQ’s

Copyright © 2023 TheITEducation.com

Design by ThemesDNA.com