Untitled

 avatar
unknown
plain_text
2 years ago
1.5 kB
2
Indexable
import java.sql.*;
import java.util.*;

public class dbConnectivity {

	public static void main(String[] args) {
		try
		{
			Class.forName("com.mysql.cj.jdbc.Driver");
			Connection con = DriverManager.getConnection("jdbc:mysql://10.10.12.108:3306/te31139db","te31139","te31139");
			Statement st = con.createStatement();
			int choice;
			Scanner sc = new Scanner(System.in);
			while(true)
			{
				System.out.println("Main Menu");
				System.out.println("1)Create table");
				System.out.println("2)Insert record");
				System.out.println("3)Update record");
				System.out.println("4)Display record");
				System.out.println("5)Delete record");
				System.out.println("6)Exit");
				System.out.print("Enter the number corresponding to the operation you want to perform:");
				choice = sc.nextInt();
				if(choice == 1)
				{
					String[] columns;
					System.out.print("Enter the name of your table:");
					String name = sc.nextLine();
					System.out.print("Enter the number of columns in your table:");
					int temp = sc.nextInt();
					for(int i=0; i<temp; i++)
					{
						
					}
				}
				else if(choice == 2)
				{
					
				}
				else if(choice == 3)
				{
					
				}
				else if(choice == 4)
				{
					
				}
				else if(choice == 5)
				{
					
				}
				else if(choice == 6)
				{
					System.out.println("Thank You!!");
					sc.close();
					break;
				}
				else
				{
					System.out.println("Please enter a proper input!!");
				}
			}
			con.close();
		}
		catch(Exception e)
		{
			System.out.println(e);
		}
	}
}
Editor is loading...