import [Link].
Application;
import [Link];
import [Link];
import static [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
public class Formulario_BD extends Application {
public void start(Stage stage) {
Text textPoli = new Text("POLITECNICO GRANCOLOMBIANO");
[Link]([Link]);
Text textNit = new Text("Nit:");
Text textNombre = new Text("Nombre");
Text textDirreccion = new Text("Dirreccion:");
Text textCorreo = new Text("Correo:");
Text textEdad = new Text("Edad:");
Text textPrimerApellido = new Text("Primer apellido:");
Text textCiudad = new Text("Cod-Ciudad:");
Text textSegundoApellido = new Text("Segundo apellido:");
Text textPais = new Text("Pais:");
Text textFecha = new Text("Fecha de nacimiento:");
Text textMostrar = new Text("DATOS:");
TextField Nit = new TextField();
TextField Nombre = new TextField();
TextField Dirreccion = new TextField();
TextField Correo = new TextField();
TextField Edad = new TextField();
TextField PrimerApellido = new TextField();
TextField Ciudad = new TextField();
TextField SegundoApellido = new TextField();
TextField Pais = new TextField();
TextField Fecha = new TextField();
TextField Mostrar = new TextField();
TextField salida = new TextField();
[Link](300);
Button btInsertar = new Button("Insertar");
Button btConsultar = new Button("Consultar");
Button btSalir = new Button("Salir");
Button btBorrar = new Button("Borrar");
GridPane gridPane = new GridPane();
[Link](500, 300);
[Link](new Insets(10, 10, 10, 10));
[Link](10);
[Link](10);
[Link]([Link]);
[Link](textPoli, 2, 0);
[Link](textNit, 0, 1);
[Link](Nit, 1, 1);
[Link](textNombre, 0, 2);
[Link](Nombre, 1, 2);
[Link](textDirreccion, 0, 3);
[Link](Dirreccion, 1, 3);
[Link](textCorreo, 0, 4);
[Link](Correo, 1, 4);
[Link](textEdad, 0, 5);
[Link](Edad, 1, 5);
[Link](textPrimerApellido, 2, 2);
[Link](PrimerApellido, 3, 2);
[Link](textCiudad, 2, 3);
[Link](Ciudad, 3, 3);
[Link](textSegundoApellido, 4, 2);
[Link](SegundoApellido, 5, 2);
[Link](textPais, 4, 3);
[Link](Pais, 5, 3);
[Link](textFecha, 2, 4);
[Link](Fecha, 3, 4);
[Link](btInsertar, 1, 6);
[Link](btConsultar, 2, 6);
[Link](btSalir, 4, 6);
[Link](btBorrar, 3, 6);
[Link](textMostrar, 0, 7);
[Link](salida, 1, 7);
[Link]("-fx-background-color: DARKMAGENTA; -fx-text-fill:
white;");
[Link]("-fx-background-color: DARKMAGENTA; -fx-text-fill:
white;");
[Link]("-fx-background-color: DARKMAGENTA; -fx-text-fill:
white;");
[Link]("-fx-background-color: DARKMAGENTA; -fx-text-fill:
white;");
// [Link]("-fx-font: normal bold 30px 'serif' ");
// [Link]("-fx-font: normal bold 30px 'serif' ");
[Link]("-fx-font: normal bold 20px 'serif';");
// [Link]("-fx-font: normal bold 20px 'serif' ");
[Link]("-fx-background-color: LIGHTBLUE;");
Scene scene = new Scene(gridPane);
[Link]("POLITECNICO GRANCOLOMBIANO");
[Link](scene);
[Link]();
[Link](new EventHandler<ActionEvent>() {
public void handle(ActionEvent event) {
String x = "Informaci�n insertada correctamente";
[Link](x);
String usuario = "Poli02";
String clave = "Poli1234";
Connection con = null;
PreparedStatement stmt = null;
String sDriver = "[Link]";
String URL = "jdbc:oracle:thin:@localhost:1521:XE";
String FecNac = [Link]();
int y1 = [Link]([Link](0, 4));
int m1 = [Link]([Link](4, 6));
int d1 = [Link]([Link](6, 8));
GregorianCalendar fechaActual = new GregorianCalendar();
int y2 = [Link]([Link]);
int m2 = [Link]([Link]) + 1;
int d2 = [Link](GregorianCalendar.DAY_OF_MONTH);
int y3 = y2 - y1;
int m3 = m2 - m1;
int d3 = d2 - d1;
if (m3 < 0 || (m3 == 0 && d3 < 0)) {
y3--;
[Link](m1);
if (y3 <= 0) {
String a�os = "Es un reci�n nacido ";
[Link](a�os);
else {
String a�os = [Link](y3) + " a�os";
[Link](a�os);
try {
[Link](sDriver).newInstance();
con = (Connection) [Link](URL,
usuario, clave);
String PAS_NIT = [Link]();
String PAS_NOM = [Link]();
String PAS_AP1 = [Link]();
String PAS_AP2 = [Link]();
String PAS_DIR = [Link]();
String PAS_CIU_ID = [Link]();
String PAS_PAIS_COD = [Link]();
String PAS_EMAIL = [Link]();
String FEC_NAC = y1 + "/" + m1 + "/" + d1;
String FEC_CREA = y2 + "/" + m2 + "/" + d2;
String PAS_EDAD = [Link](y3);
stmt = [Link]("INSERT INTO PASAJERO
VALUES (?,?,?,?,?,?,?,?,?,?,?)");
[Link](1, PAS_NIT);
[Link](2, PAS_NOM);
[Link](3, PAS_AP1);
[Link](4, PAS_AP2);
[Link](5, PAS_DIR);
[Link](6, PAS_CIU_ID);
[Link](7, PAS_PAIS_COD);
[Link](8, PAS_EMAIL);
[Link](9, FEC_NAC);
[Link](10, FEC_CREA);
[Link](11, PAS_EDAD);
int retorno = [Link]();
if (retorno > 0)
[Link]("Insertado correctamente");
} catch (SQLException sqle) {
[Link]("SQLState: " +
[Link]());
[Link]("SQLErrorCode: " +
[Link]());
[Link]();
} catch (Exception e) {
[Link]();
} finally {
if (con != null) {
try {
[Link]();
[Link]();
} catch (Exception e) {
[Link]();
[Link]([Link]());
}
});
[Link](new EventHandler<ActionEvent>() {
public void handle(ActionEvent event) {
String y = "Informaci�n borrada correctamente";
[Link](y);
String z = "";
[Link](z);
[Link](z);
[Link](z);
[Link](z);
[Link](z);
[Link](z);
[Link](z);
[Link](z);
[Link](z);
[Link](z);
});
[Link](new EventHandler<ActionEvent>() {
public void handle(ActionEvent event) {
String x = "Informaci�n consultada correctamente";
[Link](x);
try {
Connection conexion =
[Link]("jdbc:oracle:thin:@localhost:1521:xe", "Poli01",
"Poli12345");
Statement comando = [Link]();
ResultSet registro = [Link](
"select
PAS_NOM,PAS_DIR,PAS_EMAIL,FEC_NAC,PAS_AP1,PAS_CIU_ID,PAS_AP2,PAS_PAIS_COD,PAS_EDAD
from PASAJERO where PAS_NIT="
+ [Link]());
if ([Link]() == true) {
[Link]([Link]("PAS_NOM"));
[Link]([Link]("PAS_DIR"));
[Link]([Link]("PAS_EMAIL"));
[Link]([Link]("FEC_NAC"));
[Link]([Link]("PAS_AP1"));
[Link]([Link]("PAS_CIU_ID"));
[Link]([Link]("PAS_AP2"));
[Link]([Link]("PAS_PAIS_COD"));
[Link]([Link]("PAS_EDAD") + "
a�os");
[Link]("Informaci�n consultada
correctamente");
} else {
[Link]("No existe un pasajero con dicho
Nit");
[Link]();
} catch (SQLException ex) {
}
});
[Link](new EventHandler<ActionEvent>() {
public void handle(ActionEvent event) {
Node source = (Node) [Link]();
Stage stage = (Stage) [Link]().getWindow();
[Link]();
}
});
}
public static void main(String args[]) {
launch(args);
}
}