Java

Registration Form using Java MongoDb Database

In this tutorials will  teach you Java connect with MongoDb Database with Swing Application.MongoDb is a NOSQLdatabase.how to do the simple registation form connect with MongoDb Database teach step by step here.How  to connect java in to MongoDb Database.

Establish the database Connection with Java and MongoDb Database

First Install the mongodb and robo mongo i attched the video link below.

If you don’t have a idea about MongoDb Database . it is simple to learn i have attached the video link below.

 

 

After watch above video links i hope now you have clear idea about mongodb.

Lets do the Registration form

Establish the database Connection

mongo = new MongoClient(“localhost”,27017);   This is port where your robo mongodb is connected

dbconnection = mongo.getDatabase(“school”);  This is database name

collection= dbconnection.getCollection(“records”);  This is a table name

    MongoClient mongo;
    MongoDatabase dbconnection;
    MongoCollection<org.bson.Document>  collection;
   
    public void Connect()
    {    
        mongo = new MongoClient("localhost",27017);
        dbconnection = mongo.getDatabase("school");
        collection= dbconnection.getCollection("records");
        System.out.println("connect");
  
    }

after done the connet() method call inside the constructor of the class

   public Registation() {
        initComponents();
        Connect();
    }

Paste the Code Inside the Save Button

Document d =new Document("name",txtName.getText());
d.append("age",txtAge.getText());  
d.append("course",txtCourse.getText());  
collection.insertOne(d);
JOptionPane.showMessageDialog(this, "Inserted Successfully");

i have attached the video link below. which will do this tutorials step by step.

 

 

 

admin

Recent Posts

Laravel 11 CRUD Mastering RESTful API MVC with Repository Pattern

In this tutorial will teach Laravel 11 Api MVC with Repository Pattern Crud Application step…

2 weeks ago

Laravel 11 CRUD Application

In this tutorial will teach Laravel 11 CRUD Application step by step. Laravel  11 CRUD…

1 month ago

How to make Times Table in React

in this tutorials we will be talk about how to make a times table in…

1 month ago

Laravel Tutorial: How to Add Numbers Easily Laravel 10

In this tutorials will teach How to add two numbers in Laravel 10. (more…)

2 months ago

Build Full-Stack Node.js MongoDB CRUD App with JWT Authentication

In this tutorial, we will teach the process of building a full-stack application using Node.js,…

2 months ago

Hospital Management System using OOP Java and MySQL

In this tutorial, we will explin you through the process of building a Hospital Management…

3 months ago