Postgres-Netbeans

1

Hello a few days ago I asked a question in which I asked for help to know how it could generate the connection between postgres and netbeans .... In one of your answers they recommended tutorialspoint .... It is worth mentioning that the application I am doing as a school project is a point of sale for an optician in which I have to keep patient data in a file.

To generate the connection use this code ...

import java.sql.Connection;

import java.sql.DriverManager;



public class PostgreSQLJDBC {
    public static void main(String args[]){
        Connection c = null;

        try{
            Class.forName("org.postgresql.Driver");
            c = DriverManager
                    .getConnection("jdbc:postgresql://localhost:5432/postgres","postgres","12345");

        } catch (Exception e){
            e.printStackTrace();
            System.err.println(e.getClass().getName()+": "+e.getMessage());
            System.exit(0);
        }
        System.out.println("ACCESO TOTAL A LA BASE DE DATOS");
        }
    }

For this he believes in a class in java ...... Now could you tell me if this connection is ideal for the type of application I'm creating? and what should I put in the save button to call the b.d and save the files? Thank you very much & Excuse the truth is that I still have many doubts about programming and understand the code ..... Unfortunately I think I learn more by searching the Internet than with my teachers ..

    
asked by Edwin Correa 09.04.2016 в 05:05
source

1 answer

0

Your question is very broad. The connection is fine as long as you have the .jar postgresql in the classpath. You mention a button, not if you mean SWING type windows. If so, with Netbeans it is very easy, I recommend you look for some examples of CRUD with SWING and Netbeans in google

    
answered by 24.09.2018 в 14:18