-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from CodeSystem2022/NataliaLiscio
Semana 1 Java - Semestre 4
- Loading branch information
Showing
12 changed files
with
676 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
create database estudiantes; | ||
use estudiantes; | ||
create table estudiantes2022( | ||
idestudiantes2022 int auto_increment primary key, | ||
nombre varchar(50), | ||
apellido varchar(50), | ||
telefono varchar (12), | ||
email varchar (80) | ||
); | ||
|
||
/*Comenzamos con CRUD: create(crear), read(leer), update(actualizar), delete(eliminar)*/ | ||
|
||
-- Listar los estudiantes (read) | ||
SELECT * FROM estudiantes2022; | ||
|
||
-- Insertar estudiante (create) | ||
INSERT INTO estudiantes2022 (nombre, apellido, telefono, email) VALUES('Juan', 'Perez', '12233333', 'jperez@mail.com'); | ||
|
||
-- Modificar estudiante (update) | ||
UPDATE estudiantes2022 SET nombre='Juan Carlos', apellido='Garcia' WHERE idestudiantes2022=1; | ||
|
||
-- Eliminar registro (Delete) | ||
DELETE FROM estudiantes2022 WHERE idestudiantes2022=3; | ||
|
||
-- Para modificar el idestudiantes2022 y comience en 1 | ||
ALTER TABLE estudiantes2022 auto_increment = 1; | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
target/ | ||
!.mvn/wrapper/maven-wrapper.jar | ||
!**/src/main/**/target/ | ||
!**/src/test/**/target/ | ||
|
||
### IntelliJ IDEA ### | ||
.idea/modules.xml | ||
.idea/jarRepositories.xml | ||
.idea/compiler.xml | ||
.idea/libraries/ | ||
*.iws | ||
*.iml | ||
*.ipr | ||
|
||
### Eclipse ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
.sts4-cache | ||
|
||
### NetBeans ### | ||
/nbproject/private/ | ||
/nbbuild/ | ||
/dist/ | ||
/nbdist/ | ||
/.nb-gradle/ | ||
build/ | ||
!**/src/main/**/build/ | ||
!**/src/test/**/build/ | ||
|
||
### VS Code ### | ||
.vscode/ | ||
|
||
### Mac OS ### | ||
.DS_Store |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
124 changes: 124 additions & 0 deletions
124
Metodología/Java/SistemaEstudiantes/.idea/uiDesigner.xml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>UTN</groupId> | ||
<artifactId>estudiante</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
|
||
<dependencies> | ||
<!-- https://mvnrepository.com/artifact/com.mysql/mysql-connector-j --> | ||
<dependency> | ||
<groupId>com.mysql</groupId> | ||
<artifactId>mysql-connector-j</artifactId> | ||
<version>8.0.33</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<properties> | ||
<maven.compiler.source>20</maven.compiler.source> | ||
<maven.compiler.target>20</maven.compiler.target> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
|
||
</project> |
27 changes: 27 additions & 0 deletions
27
Metodología/Java/SistemaEstudiantes/src/main/java/UTN/conexion/Conexion.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package UTN.conexion; | ||
|
||
|
||
import java.sql.Connection; | ||
import java.sql.DriverManager; | ||
import java.sql.SQLException; | ||
|
||
public class Conexion { | ||
|
||
public static Connection getConnection(){ | ||
Connection conexion = null; | ||
//Variables para conectarnos a la base de datos | ||
var baseDatos = "estudiantes"; | ||
var url = "jdbc:mysql://localhost:3306/"+baseDatos; | ||
var usuario = "admin"; | ||
var password = "pilar1004"; | ||
|
||
//cargamos la clase del driver de mysql en memoria | ||
try { | ||
Class.forName("com.mysql.cj.jdbc.Driver"); | ||
conexion = DriverManager.getConnection(url, usuario, password); | ||
} catch (ClassNotFoundException | SQLException e){ | ||
System.out.println("Ocurrio un error en la conexion: "+e.getMessage()); | ||
}//Fin Catch | ||
return conexion; | ||
} | ||
} |
Oops, something went wrong.