Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package javaapplication5;
- import java.sql.*;
- public class prueba {
- // Declaración de la clase JDBC del driver fmjdbc.jar
- static final String JDBC_DRIVER = "com.filemaker.jdbc.Driver";
- // Declaración de la URL del Servidor FileMaker
- static final String DB_URL = "jdbc:filemaker://175.0.0.228/BasedeDatos";
- // Credenciales de conexión a la Base de Datos FileMaker
- static final String USER = "vmorales";
- static final String PASS = "pass";
- public static void main(String[] args) {
- Connection conn = null;
- Statement stmt = null;
- try {
- // Carga de la clase JDBC del driver fmjdbc.jar
- Class.forName("com.filemaker.jdbc.Driver");
- System.out.println("Conectamos a la base de datos.");
- conn = DriverManager.getConnection(DB_URL, USER, PASS);
- System.out.println("Creamos la consulta");
- stmt = conn.createStatement();
- String sql;
- sql = "SELECT * FROM INSUMOS WHERE STOCK_BODEGA < 5";
- ResultSet rs = stmt.executeQuery(sql);
- int i = 0;
- while (rs.next()) {
- i++;
- System.out.println(i + " REGISTRO");
- }
- rs.close();
- stmt.close();
- conn.close();
- } catch (SQLException se) {
- se.printStackTrace();
- } catch (Exception e) {
- e.printStackTrace();
- } finally {
- try {
- if (stmt != null) {
- stmt.close();
- }
- } catch (SQLException sqlexcepcion) {
- }
- try {
- if (conn != null) {
- conn.close();
- }
- } catch (SQLException se) {
- se.printStackTrace();
- }
- }
- System.out.println("FIN");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement