Skip to main content

Posts

Linux Shell - Arithmetic Operations solution

 Linux Shell - Arithmetic Operations solution for explanation watch video:: code:: read string res= $(echo "scale=4;$string" | bc) printf  "%.3f"   "$res"  

how to store html form data in mysql database using java

how to store html form data in mysql database using java for explanation watch the video:: Step 1 : Create the peroject step 2 : create home.html in webapp step 3 : home.html home.html ========== <!DOCTYPE html> <html> <head> <meta charset="ISO-8859-1"> <title>Insert title here</title> <!-- Latest compiled and minified CSS --> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css"> <!-- jQuery library --> <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js"></script> <!-- Popper JS --> <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js"></script> <!-- Latest compiled JavaScript --> <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/js/bootstrap.bundle.min.js"></script> <style> #div1 { width: 600p...

Weather Observation Station 19 Hackerrank Solution - SQL

  Weather Observation Station 19 Hackerrank Solution - SQL  for explanation watch video :: Code:: select round(sqrt(     power(max(lat_n)-min(lat_N),2)+     power(max(long_w)-min(long_w),2) ),4) from station;

Weather Observation Station 15 Hackerrank Solution - SQL

 Weather Observation Station 15 Hackerrank Solution - SQL For explanation watch video :: Code:: select round(long_w,4) from station where lat_n = (select max(lat_n) from station where lat_n<137.2345);

Weather Observation Station 14 Hackerrank Solution - SQL

Weather Observation Station 14 Hackerrank Solution - SQL For explanation watch video :: Code:: select round(max(LAT_N),4) from station where LAT_N < 137.2345;

Transaction Management in JDBC | JDBC Tutorial

  Transaction Management in JDBC For explanation watch video :: Code:: import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Statement; import java.util.Scanner; public class OracleConn { public static void main(String[] args) { String url = "jdbc:oracle:thin:@localhost:1521:orcl"; String uname = "system"; String pwd = "tiger"; // take source account number and dest acc number from user Scanner scn = new Scanner(System.in); System.out.println("Enter source acc no: "); long srcAcNo = scn.nextLong(); System.out.println("Enter dest acc no: "); long destAcNo = scn.nextLong(); // take the amt to transfer System.out.println("Enter amt to transfer: "); long amt = scn.nextLong(); try (Connection con = DriverManager.getConnection(url, uname, pwd);  Statement st = con.createStatement();) { // Begin Tx if (con != null) con.set...

Batch Processing in JDBC

 Batch Processing in JDBC Code:: for explanation watch video : package com.jdbc; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Statement; public class OracleConn { public static void main(String[] args) { try (Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "system", "tiger"); Statement st = con.createStatement()) { // add queries to batch ..these queries can belong to same db table or different // db tables but must be non-select Queries st.addBatch("INSERT INTO STUDENT VALUES(4444,'david',55.77,'france')"); st.addBatch("UPDATE  STUDENT SET AVG=AVG+10 WHERE SNO=2"); st.addBatch("DELETE FROM STUDENT WHERE SNO=1"); // execute the batch int result[] = st.executeBatch(); // find sum of the records that are effected int sum = 0; for (int i = 0; i < result.length; ++i)...