This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.luv2code.jdbc.employeesearch.dao; | |
import java.io.FileInputStream; | |
import java.sql.Connection; | |
import java.sql.DriverManager; | |
import java.sql.PreparedStatement; | |
import java.sql.ResultSet; | |
import java.sql.SQLException; | |
import java.sql.Statement; | |
import java.sql.Timestamp; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.luv2code.jdbc.employeesearch.ui; | |
import java.awt.BorderLayout; | |
import java.awt.EventQueue; | |
import javax.swing.JFrame; | |
import javax.swing.JPanel; | |
import javax.swing.border.EmptyBorder; | |
import javax.swing.JLabel; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create database if not exists demo; | |
use demo; | |
drop table if exists employees; | |
CREATE TABLE `employees` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`last_name` varchar(64) DEFAULT NULL, | |
`first_name` varchar(64) DEFAULT NULL, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.nio.file.Path; | |
import java.nio.file.Paths; | |
import java.nio.file.StandardWatchEventKinds; | |
import java.nio.file.WatchEvent; | |
import java.nio.file.WatchKey; | |
import java.nio.file.WatchService; | |
import java.util.List; | |
public class Driver { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.luv2code.springdemo.mvc; | |
import java.util.LinkedHashMap; | |
public class Student { | |
private String firstName; | |
private String lastName; | |
private String favoriteLanguage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE `employees` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`last_name` varchar(64) DEFAULT NULL, | |
`first_name` varchar(64) DEFAULT NULL, | |
`checkout_time` timestamp DEFAULT NULL, | |
PRIMARY KEY (`id`) | |
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String sql = "INSERT INTO employees (last_name, first_name, checkout_time) values (?, ?, ?)"; | |
PreparedStatement myStmt = myConn.prepareStatement(sql); | |
... | |
java.util.Date now = new java.util.Date(); | |
java.sql.Timestamp currentTimetamp = new java.sql.Timestamp(now.getTime()); | |
myStmt.setTimestamp(3, currentTimestamp); | |
myStmt.executeUpdate(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String sql = "select * from employees"; | |
ResultSet myRs = myStmt.executeQuery(sql); | |
while (myRs.next()) { | |
System.out.println(myRs.getTimestamp("checkout_time")); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Add Student</title> | |
<link type="text/css" rel="stylesheet" href="css/style.css"> | |
<link type="text/css" rel="stylesheet" href="css/add-student-style.css"> | |
</head> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head><title>Student Registration Form</title></head> | |
<body> | |
<form action="student-dropdown-response.jsp"> | |
First name: <input type="text" name="firstName" /> | |
OlderNewer