Erro ao conectar com postgre

Estou com um erro no meu codigo tipo:
Exception in thread “AWT-EventQueue-0” Local Exception Stack:
Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))): oracle.toplink.essentials.exceptions.DatabaseException
Internal Exception: org.postgresql.util.PSQLException: FATAL: autentica��o do tipo password falhou para usu�rio “postgres”
Error Code: 0

me disseram que eu tenho que alterar alguma ccoisa na parte de password etc, mas no postgre ou no meu codigo fonte e se for nele, em que lugar?

Posta o código.

É realmente problema na autenticação.

[TopLink Info]: 2009.11.27 02:02:57.017–ServerSession(16805237)–TopLink, version: Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))
Exception in thread “AWT-EventQueue-0” Local Exception Stack:
Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))): oracle.toplink.essentials.exceptions.DatabaseException
Internal Exception: org.postgresql.util.PSQLException: FATAL: autentica��o do tipo password falhou para usu�rio “postgres”
Error Code: 0
at oracle.toplink.essentials.exceptions.DatabaseException.sqlException(DatabaseException.java:305)
at oracle.toplink.essentials.sessions.DefaultConnector.connect(DefaultConnector.java:102)
at oracle.toplink.essentials.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:184)
at oracle.toplink.essentials.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:582)
at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:280)
at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:229)
at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:93)
at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:126)
at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:120)
at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:91)
at telas.TVacas.initComponents(TVacas.java:40)
at telas.TVacas.(TVacas.java:26)
at telas.TPrincipal.jMenuItem1ActionPerformed(TPrincipal.java:112)
at telas.TPrincipal.access$100(TPrincipal.java:18)
at telas.TPrincipal$2.actionPerformed(TPrincipal.java:59)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1220)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1261)
at java.awt.Component.processMouseEvent(Component.java:6041)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
at java.awt.Component.processEvent(Component.java:5806)
at java.awt.Container.processEvent(Container.java:2058)
at java.awt.Component.dispatchEventImpl(Component.java:4413)
at java.awt.Container.dispatchEventImpl(Container.java:2116)
at java.awt.Component.dispatchEvent(Component.java:4243)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
at java.awt.Container.dispatchEventImpl(Container.java:2102)
at java.awt.Window.dispatchEventImpl(Window.java:2440)
at java.awt.Component.dispatchEvent(Component.java:4243)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
Caused by: org.postgresql.util.PSQLException: FATAL: autentica��o do tipo password falhou para usu�rio “postgres”
at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:291)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:108)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:66)
at org.postgresql.jdbc2.AbstractJdbc2Connection.(AbstractJdbc2Connection.java:125)
at org.postgresql.jdbc3.AbstractJdbc3Connection.(AbstractJdbc3Connection.java:30)
at org.postgresql.jdbc3g.AbstractJdbc3gConnection.(AbstractJdbc3gConnection.java:22)
at org.postgresql.jdbc4.AbstractJdbc4Connection.(AbstractJdbc4Connection.java:30)
at org.postgresql.jdbc4.Jdbc4Connection.(Jdbc4Connection.java:24)
at org.postgresql.Driver.makeConnection(Driver.java:393)
at org.postgresql.Driver.connect(Driver.java:267)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:154)
at oracle.toplink.essentials.sessions.DefaultConnector.connect(DefaultConnector.java:100)
… 40 more

O erro eu já tinha visto, inclusive no outro post sobre o mesmo assunto.

Mostre o código que está causando este erro.

Esse problema é falha de autenticação…

Então, sou novato demais da conta, eu não sei em qual parte do codido esta o erro, não sei achar…

Boa tarde.

Ser novato não é um problema, só deve ficar atento ao que os colegas dizem, ou seja, poste o seu código para analisarmos e dessa forma possamos ajuda-lo.

Abraços.

Coloca o fonte do TVacas.java todo aqui.

ok:
package telas;

import dao.ProLeiteDao;
import javax.swing.JOptionPane;
import to.Vacas;

/**
*

  • @author User
    */
    public class TVacas extends javax.swing.JFrame {

    /** Creates new form TVacas */
    public TVacas() {
    initComponents();
    // Vacas t= new Vacas;
    }

    /** This method is called from within the constructor to

    • initialize the form.

    • WARNING: Do NOT modify this code. The content of this method is

    • always regenerated by the Form Editor.
      */
      @SuppressWarnings(“unchecked”)
      //
      private void initComponents() {
      bindingGroup = new org.jdesktop.beansbinding.BindingGroup();

      MegaLeitePUEntityManager = java.beans.Beans.isDesignTime() ? null : javax.persistence.Persistence.createEntityManagerFactory(“UP”).createEntityManager();
      vacaQuery = java.beans.Beans.isDesignTime() ? null : MegaLeitePUEntityManager.createQuery(“SELECT v FROM Vaca v”);
      vacaQuery1 = java.beans.Beans.isDesignTime() ? null : MegaLeitePUEntityManager.createQuery(“SELECT v FROM Vaca v”);
      UPEntityManager = java.beans.Beans.isDesignTime() ? null : javax.persistence.Persistence.createEntityManagerFactory(“UP”).createEntityManager();
      vacasQuery = java.beans.Beans.isDesignTime() ? null : UPEntityManager.createQuery(“SELECT v FROM Vacas v”);
      vacasList = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : vacasQuery.getResultList();
      jTabbedPane1 = new javax.swing.JTabbedPane();
      jPanel1 = new javax.swing.JPanel();
      jLabel1 = new javax.swing.JLabel();
      jButton1 = new javax.swing.JButton();
      jButton2 = new javax.swing.JButton();
      jButton3 = new javax.swing.JButton();
      jButton4 = new javax.swing.JButton();
      jButton5 = new javax.swing.JButton();
      jLabel2 = new javax.swing.JLabel();
      jLabel3 = new javax.swing.JLabel();
      jLabel4 = new javax.swing.JLabel();
      jLabel5 = new javax.swing.JLabel();
      campocodigo = new javax.swing.JTextField();
      camporegistro = new javax.swing.JTextField();
      camporaca = new javax.swing.JTextField();
      campodata = new javax.swing.JTextField();
      jPanel2 = new javax.swing.JPanel();
      jScrollPane2 = new javax.swing.JScrollPane();
      jTable2 = new javax.swing.JTable();

      setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

      jLabel1.setText(“CADASTRO DE VACAS”);

      jButton1.setText(“salvar”);
      jButton1.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
      jButton1ActionPerformed(evt);
      }
      });

      jButton2.setText(“consultar”);
      jButton2.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
      jButton2ActionPerformed(evt);
      }
      });

      jButton3.setText(“excluir”);
      jButton3.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
      jButton3ActionPerformed(evt);
      }
      });

      jButton4.setText(“limpar”);
      jButton4.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
      jButton4ActionPerformed(evt);
      }
      });

      jButton5.setText(“sair”);
      jButton5.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
      jButton5ActionPerformed(evt);
      }
      });

      jLabel2.setText(“CÓDIGO”);

      jLabel3.setText(“Nº REGISTRO”);

      jLabel4.setText(“RAÇA”);

      jLabel5.setText(“DATA AQUISIÇÃO”);

      javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
      jPanel1.setLayout(jPanel1Layout);
      jPanel1Layout.setHorizontalGroup(
      jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGroup(jPanel1Layout.createSequentialGroup()
      .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGroup(jPanel1Layout.createSequentialGroup()
      .addGap(137, 137, 137)
      .addComponent(jLabel1))
      .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
      .addGap(18, 18, 18)
      .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addComponent(jLabel2)
      .addComponent(jLabel3)
      .addComponent(jLabel4)
      .addComponent(jLabel5))
      .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGroup(jPanel1Layout.createSequentialGroup()
      .addGap(21, 21, 21)
      .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addComponent(campocodigo, javax.swing.GroupLayout.DEFAULT_SIZE, 152, Short.MAX_VALUE)
      .addComponent(camporegistro, javax.swing.GroupLayout.DEFAULT_SIZE, 152, Short.MAX_VALUE)
      .addComponent(camporaca, javax.swing.GroupLayout.DEFAULT_SIZE, 152, Short.MAX_VALUE)))
      .addGroup(jPanel1Layout.createSequentialGroup()
      .addGap(18, 18, 18)
      .addComponent(campodata, javax.swing.GroupLayout.DEFAULT_SIZE, 155, Short.MAX_VALUE)))
      .addGap(78, 78, 78)
      .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
      .addComponent(jButton1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)
      .addComponent(jButton4, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 77, Short.MAX_VALUE)
      .addComponent(jButton3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 77, Short.MAX_VALUE)
      .addComponent(jButton2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
      .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
      .addGap(339, 339, 339)
      .addComponent(jButton5, javax.swing.GroupLayout.DEFAULT_SIZE, 95, Short.MAX_VALUE)))
      .addContainerGap())
      );
      jPanel1Layout.setVerticalGroup(
      jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGroup(jPanel1Layout.createSequentialGroup()
      .addGap(19, 19, 19)
      .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
      .addGroup(jPanel1Layout.createSequentialGroup()
      .addGap(35, 35, 35)
      .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
      .addComponent(jLabel2)
      .addComponent(campocodigo)))
      .addGroup(jPanel1Layout.createSequentialGroup()
      .addComponent(jLabel1)
      .addGap(18, 18, Short.MAX_VALUE)
      .addComponent(jButton1)))
      .addGap(18, 18, 18)
      .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGroup(jPanel1Layout.createSequentialGroup()
      .addGap(3, 3, 3)
      .addComponent(camporegistro))
      .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
      .addComponent(jButton2)
      .addComponent(jLabel3)))
      .addGap(18, 18, 18)
      .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGroup(jPanel1Layout.createSequentialGroup()
      .addGap(3, 3, 3)
      .addComponent(camporaca))
      .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
      .addComponent(jButton3)
      .addComponent(jLabel4)))
      .addGap(18, 18, 18)
      .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGroup(jPanel1Layout.createSequentialGroup()
      .addGap(3, 3, 3)
      .addComponent(campodata))
      .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
      .addComponent(jButton4)
      .addComponent(jLabel5)))
      .addGap(18, 18, 18)
      .addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
      .addGap(73, 73, 73))
      );

      jTabbedPane1.addTab(“Manutenção”, jPanel1);

      org.jdesktop.swingbinding.JTableBinding jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, vacasList, jTable2);
      org.jdesktop.swingbinding.JTableBinding.ColumnBinding columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${codigo}"));
      columnBinding.setColumnName(“Codigo”);
      columnBinding.setColumnClass(Integer.class);
      columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${numregistro}"));
      columnBinding.setColumnName(“Numregistro”);
      columnBinding.setColumnClass(Integer.class);
      columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${raca}"));
      columnBinding.setColumnName(“Raca”);
      columnBinding.setColumnClass(String.class);
      columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${data}"));
      columnBinding.setColumnName(“Data”);
      columnBinding.setColumnClass(java.util.Date.class);
      bindingGroup.addBinding(jTableBinding);
      jTableBinding.bind();

      jScrollPane2.setViewportView(jTable2);

      javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
      jPanel2.setLayout(jPanel2Layout);
      jPanel2Layout.setHorizontalGroup(
      jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 444, Short.MAX_VALUE)
      );
      jPanel2Layout.setVerticalGroup(
      jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 311, Short.MAX_VALUE)
      );

      jTabbedPane1.addTab(“Pesquisa”, jPanel2);

      javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
      getContentPane().setLayout(layout);
      layout.setHorizontalGroup(
      layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 449, Short.MAX_VALUE)
      );
      layout.setVerticalGroup(
      layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addComponent(jTabbedPane1)
      );

      bindingGroup.bind();

      pack();
      }//

    private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {
    sair(); // TODO add your handling code here:
    }

    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
    limpar(); // TODO add your handling code here:
    }

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
    salvar(); // TODO add your handling code here:
    }

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
    excluir(); // TODO add your handling code here:
    }

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
    consultar(); // TODO add your handling code here:
    }

    /**

    • @param args the command line arguments
      */
      public static void main(String args[]) {
      java.awt.EventQueue.invokeLater(new Runnable() {
      public void run() {
      new TVacas().setVisible(true);
      }
      });
      }

    // Variables declaration - do not modify
    private javax.persistence.EntityManager MegaLeitePUEntityManager;
    private javax.persistence.EntityManager UPEntityManager;
    private javax.swing.JTextField campocodigo;
    private javax.swing.JTextField campodata;
    private javax.swing.JTextField camporaca;
    private javax.swing.JTextField camporegistro;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton5;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTable jTable2;
    private javax.persistence.Query vacaQuery;
    private javax.persistence.Query vacaQuery1;
    private java.util.List<to.Vacas> vacasList;
    private javax.persistence.Query vacasQuery;
    private org.jdesktop.beansbinding.BindingGroup bindingGroup;
    // End of variables declaration

    private void sair(){
    dispose();
    }

    private void limpar() {
    campocodigo.setText("");
    camporegistro.setText("");
    camporaca.setText("");
    campodata.setText("");
    }
    private void salvar(){
    Vacas t = new Vacas();
    t.setCodigo(Integer.parseInt(campocodigo.getText()) );
    t.setNumregistro(Integer.parseInt(camporegistro.getText()));
    t.setRaca(camporaca.getText());
    t.setData(Integer.parseInt(campodata.getText()));

    try{
    ProLeiteDao.salvar(t);
    }
    catch(Exception e){
    JOptionPane.showMessageDialog(null,e,“Erro”,0);
    }
    limpar();

    }
    private void excluir(){
    int chave = Integer.parseInt(campocodigo.getText());
    try{
    ProLeiteDao.excluir(“Vacas.finByCodigo”,“codigo”,chave);
    }
    catch(Exception e){
    JOptionPane.showMessageDialog(null,“VACA NÃO EXISTE”,“ERRO”,0);
    }
    limpar();
    }
    private void consultar(){
    int chave = Integer.parseInt(campocodigo.getText());
    Object obj1=new Object();
    try{
    obj1 = ProLeiteDao.consultar(“Vaca.findByCodigo”,“codigo”,chave);
    }
    catch(Exception e){
    JOptionPane.showMessageDialog(null,“VACA NÃO CADASTRADA”,“ERRO”,0);
    }
    Vacas t = new Vacas();
    t.setCodigo(Integer.parseInt(campocodigo.getText()) );
    t.setNumregistro(Integer.parseInt(camporegistro.getText()));
    t.setRaca(camporaca.getText());
    t.setData(Integer.parseInt(campodata.getText()));
    }

}

Antes de mais nada, sempre use as tagas “code” para edentar seu código, senão fica muito complicado de entender, vou postar o seu código edentado (fica como exemplo) para que todos possamos analisar melhor.

package telas; 

import dao.ProLeiteDao; 
import javax.swing.JOptionPane; 
import to.Vacas; 

/** 
* 
* @author User 
*/ 
public class TVacas extends javax.swing.JFrame { 

/** Creates new form TVacas */ 
public TVacas() { 
initComponents(); 
// Vacas t= new Vacas; 
} 

/** This method is called from within the constructor to 
* initialize the form. 
* WARNING: Do NOT modify this code. The content of this method is 
* always regenerated by the Form Editor. 
*/ 
@SuppressWarnings("unchecked") 
// <editor-fold defaultstate="collapsed" desc="Generated Code"> 
private void initComponents() { 
bindingGroup = new org.jdesktop.beansbinding.BindingGroup(); 

MegaLeitePUEntityManager = java.beans.Beans.isDesignTime() ? null : javax.persistence.Persistence.createEntityManagerFactory("UP").createEntityManager(); 
vacaQuery = java.beans.Beans.isDesignTime() ? null : MegaLeitePUEntityManager.createQuery("SELECT v FROM Vaca v"); 
vacaQuery1 = java.beans.Beans.isDesignTime() ? null : MegaLeitePUEntityManager.createQuery("SELECT v FROM Vaca v"); 
UPEntityManager = java.beans.Beans.isDesignTime() ? null : javax.persistence.Persistence.createEntityManagerFactory("UP").createEntityManager(); 
vacasQuery = java.beans.Beans.isDesignTime() ? null : UPEntityManager.createQuery("SELECT v FROM Vacas v"); 
vacasList = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : vacasQuery.getResultList(); 
jTabbedPane1 = new javax.swing.JTabbedPane(); 
jPanel1 = new javax.swing.JPanel(); 
jLabel1 = new javax.swing.JLabel(); 
jButton1 = new javax.swing.JButton(); 
jButton2 = new javax.swing.JButton(); 
jButton3 = new javax.swing.JButton(); 
jButton4 = new javax.swing.JButton(); 
jButton5 = new javax.swing.JButton(); 
jLabel2 = new javax.swing.JLabel(); 
jLabel3 = new javax.swing.JLabel(); 
jLabel4 = new javax.swing.JLabel(); 
jLabel5 = new javax.swing.JLabel(); 
campocodigo = new javax.swing.JTextField(); 
camporegistro = new javax.swing.JTextField(); 
camporaca = new javax.swing.JTextField(); 
campodata = new javax.swing.JTextField(); 
jPanel2 = new javax.swing.JPanel(); 
jScrollPane2 = new javax.swing.JScrollPane(); 
jTable2 = new javax.swing.JTable(); 

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); 

jLabel1.setText("CADASTRO DE VACAS"); 

jButton1.setText("salvar"); 
jButton1.addActionListener(new java.awt.event.ActionListener() { 
public void actionPerformed(java.awt.event.ActionEvent evt) { 
jButton1ActionPerformed(evt); 
} 
}); 

jButton2.setText("consultar"); 
jButton2.addActionListener(new java.awt.event.ActionListener() { 
public void actionPerformed(java.awt.event.ActionEvent evt) { 
jButton2ActionPerformed(evt); 
} 
}); 

jButton3.setText("excluir"); 
jButton3.addActionListener(new java.awt.event.ActionListener() { 
public void actionPerformed(java.awt.event.ActionEvent evt) { 
jButton3ActionPerformed(evt); 
} 
}); 

jButton4.setText("limpar"); 
jButton4.addActionListener(new java.awt.event.ActionListener() { 
public void actionPerformed(java.awt.event.ActionEvent evt) { 
jButton4ActionPerformed(evt); 
} 
}); 

jButton5.setText("sair"); 
jButton5.addActionListener(new java.awt.event.ActionListener() { 
public void actionPerformed(java.awt.event.ActionEvent evt) { 
jButton5ActionPerformed(evt); 
} 
}); 

jLabel2.setText("CÓDIGO"); 

jLabel3.setText("Nº REGISTRO"); 

jLabel4.setText("RAÇA"); 

jLabel5.setText("DATA AQUISIÇÃO"); 

javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); 
jPanel1.setLayout(jPanel1Layout); 
jPanel1Layout.setHorizontalGroup( 
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 
.addGroup(jPanel1Layout.createSequentialGroup() 
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 
.addGroup(jPanel1Layout.createSequentialGroup() 
.addGap(137, 137, 137) 
.addComponent(jLabel1)) 
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() 
.addGap(18, 18, 1 
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 
.addComponent(jLabel2) 
.addComponent(jLabel3) 
.addComponent(jLabel4) 
.addComponent(jLabel5)) 
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 
.addGroup(jPanel1Layout.createSequentialGroup() 
.addGap(21, 21, 21) 
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 
.addComponent(campocodigo, javax.swing.GroupLayout.DEFAULT_SIZE, 152, Short.MAX_VALUE) 
.addComponent(camporegistro, javax.swing.GroupLayout.DEFAULT_SIZE, 152, Short.MAX_VALUE) 
.addComponent(camporaca, javax.swing.GroupLayout.DEFAULT_SIZE, 152, Short.MAX_VALUE))) 
.addGroup(jPanel1Layout.createSequentialGroup() 
.addGap(18, 18, 1 
.addComponent(campodata, javax.swing.GroupLayout.DEFAULT_SIZE, 155, Short.MAX_VALUE))) 
.addGap(78, 78, 7 
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) 
.addComponent(jButton1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE) 
.addComponent(jButton4, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 77, Short.MAX_VALUE) 
.addComponent(jButton3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 77, Short.MAX_VALUE) 
.addComponent(jButton2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) 
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() 
.addGap(339, 339, 339) 
.addComponent(jButton5, javax.swing.GroupLayout.DEFAULT_SIZE, 95, Short.MAX_VALUE))) 
.addContainerGap()) 
); 
jPanel1Layout.setVerticalGroup( 
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 
.addGroup(jPanel1Layout.createSequentialGroup() 
.addGap(19, 19, 19) 
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) 
.addGroup(jPanel1Layout.createSequentialGroup() 
.addGap(35, 35, 35) 
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 
.addComponent(jLabel2) 
.addComponent(campocodigo))) 
.addGroup(jPanel1Layout.createSequentialGroup() 
.addComponent(jLabel1) 
.addGap(18, 18, Short.MAX_VALUE) 
.addComponent(jButton1))) 
.addGap(18, 18, 1 
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 
.addGroup(jPanel1Layout.createSequentialGroup() 
.addGap(3, 3, 3) 
.addComponent(camporegistro)) 
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 
.addComponent(jButton2) 
.addComponent(jLabel3))) 
.addGap(18, 18, 1 
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 
.addGroup(jPanel1Layout.createSequentialGroup() 
.addGap(3, 3, 3) 
.addComponent(camporaca)) 
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 
.addComponent(jButton3) 
.addComponent(jLabel4))) 
.addGap(18, 18, 1 
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 
.addGroup(jPanel1Layout.createSequentialGroup() 
.addGap(3, 3, 3) 
.addComponent(campodata)) 
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 
.addComponent(jButton4) 
.addComponent(jLabel5))) 
.addGap(18, 18, 1 
.addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE) 
.addGap(73, 73, 73)) 
); 

jTabbedPane1.addTab("Manutenção", jPanel1); 

org.jdesktop.swingbinding.JTableBinding jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, vacasList, jTable2); 
org.jdesktop.swingbinding.JTableBinding.ColumnBinding columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${codigo}")); 
columnBinding.setColumnName("Codigo"); 
columnBinding.setColumnClass(Integer.class); 
columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${numregistro}")); 
columnBinding.setColumnName("Numregistro"); 
columnBinding.setColumnClass(Integer.class); 
columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${raca}")); 
columnBinding.setColumnName("Raca"); 
columnBinding.setColumnClass(String.class); 
columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${data}")); 
columnBinding.setColumnName("Data"); 
columnBinding.setColumnClass(java.util.Date.class); 
bindingGroup.addBinding(jTableBinding); 
jTableBinding.bind(); 

jScrollPane2.setViewportView(jTable2); 

javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); 
jPanel2.setLayout(jPanel2Layout); 
jPanel2Layout.setHorizontalGroup( 
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 444, Short.MAX_VALUE) 
); 
jPanel2Layout.setVerticalGroup( 
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 
.addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 311, Short.MAX_VALUE) 
); 

jTabbedPane1.addTab("Pesquisa", jPanel2); 

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); 
getContentPane().setLayout(layout); 
layout.setHorizontalGroup( 
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 
.addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 449, Short.MAX_VALUE) 
); 
layout.setVerticalGroup( 
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 
.addComponent(jTabbedPane1) 
); 

bindingGroup.bind(); 

pack(); 
}// </editor-fold> 

private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) { 
sair(); // TODO add your handling code here: 
} 

private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) { 
limpar(); // TODO add your handling code here: 
} 

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { 
salvar(); // TODO add your handling code here: 
} 

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) { 
excluir(); // TODO add your handling code here: 
} 

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { 
consultar(); // TODO add your handling code here: 
} 

/** 
* @param args the command line arguments 
*/ 
public static void main(String args[]) { 
java.awt.EventQueue.invokeLater(new Runnable() { 
public void run() { 
new TVacas().setVisible(true); 
} 
}); 
} 

// Variables declaration - do not modify 
private javax.persistence.EntityManager MegaLeitePUEntityManager; 
private javax.persistence.EntityManager UPEntityManager; 
private javax.swing.JTextField campocodigo; 
private javax.swing.JTextField campodata; 
private javax.swing.JTextField camporaca; 
private javax.swing.JTextField camporegistro; 
private javax.swing.JButton jButton1; 
private javax.swing.JButton jButton2; 
private javax.swing.JButton jButton3; 
private javax.swing.JButton jButton4; 
private javax.swing.JButton jButton5; 
private javax.swing.JLabel jLabel1; 
private javax.swing.JLabel jLabel2; 
private javax.swing.JLabel jLabel3; 
private javax.swing.JLabel jLabel4; 
private javax.swing.JLabel jLabel5; 
private javax.swing.JPanel jPanel1; 
private javax.swing.JPanel jPanel2; 
private javax.swing.JScrollPane jScrollPane2; 
private javax.swing.JTabbedPane jTabbedPane1; 
private javax.swing.JTable jTable2; 
private javax.persistence.Query vacaQuery; 
private javax.persistence.Query vacaQuery1; 
private java.util.List<to.Vacas> vacasList; 
private javax.persistence.Query vacasQuery; 
private org.jdesktop.beansbinding.BindingGroup bindingGroup; 
// End of variables declaration 

private void sair(){ 
dispose(); 
} 

private void limpar() { 
campocodigo.setText(""); 
camporegistro.setText(""); 
camporaca.setText(""); 
campodata.setText(""); 
} 
private void salvar(){ 
Vacas t = new Vacas(); 
t.setCodigo(Integer.parseInt(campocodigo.getText()) ); 
t.setNumregistro(Integer.parseInt(camporegistro.getText())); 
t.setRaca(camporaca.getText()); 
t.setData(Integer.parseInt(campodata.getText())); 

try{ 
ProLeiteDao.salvar(t); 
} 
catch(Exception e){ 
JOptionPane.showMessageDialog(null,e,"Erro",0); 
} 
limpar(); 

} 
private void excluir(){ 
int chave = Integer.parseInt(campocodigo.getText()); 
try{ 
ProLeiteDao.excluir("Vacas.finByCodigo","codigo",chave); 
} 
catch(Exception e){ 
JOptionPane.showMessageDialog(null,"VACA NÃO EXISTE","ERRO",0); 
} 
limpar(); 
} 
private void consultar(){ 
int chave = Integer.parseInt(campocodigo.getText()); 
Object obj1=new Object(); 
try{ 
obj1 = ProLeiteDao.consultar("Vaca.findByCodigo","codigo",chave); 
} 
catch(Exception e){ 
JOptionPane.showMessageDialog(null,"VACA NÃO CADASTRADA","ERRO",0); 
} 
Vacas t = new Vacas(); 
t.setCodigo(Integer.parseInt(campocodigo.getText()) ); 
t.setNumregistro(Integer.parseInt(camporegistro.getText())); 
t.setRaca(camporaca.getText()); 
t.setData(Integer.parseInt(campodata.getText())); 
} 

}

Então, as coisas estão bem corridas por aqui, eu diria duas coisas:

1 - Seu código está bem confuso
2 - Posta o arquivo de configuração

Com absoluta certeza é problema na autenticação com a Database, verifique o Login/Senha que adicionou se está correto ok?!
Abraços.

O servidor de banco de dados (no caso postgres) está inicializado? Você tem acesso via pgAdmin, por exemplo?

Desculpe a ignorância mas, onde localizo esse arquivo de configuração ? netbeans ou no postgre?
e o login e senha onde fica?

Sim ele esta conectado normal

Coloca o código do ProLeiteDao.java.

OK vou te mandar tambem o codigo xml ok?

[code]package dao;

import java.util.List;
import javax.persistence.*;

public class ProLeiteDao {
public static void salvar (Object objeto) {
EntityManager ent;
ent = Persistence.createEntityManagerFactory(“UP”).createEntityManager();
ent.getTransaction().begin();
//ent.persist(objeto); //somente inclui
ent.merge(objeto);
ent.getTransaction().commit();
}

public static List listar(String nomePesquisa) {
    EntityManager ent;
    ent = Persistence.createEntityManagerFactory("UP").createEntityManager();
    Query q = ent.createNamedQuery(nomePesquisa);
    List lista = q.getResultList();
    return lista;
  }
    public static List listarSql(String sql) {
    EntityManager ent;
    ent = Persistence.createEntityManagerFactory("UP").createEntityManager();
    Query q = ent.createQuery(sql);
    List lista = q.getResultList();
    return lista;
  }
      public static int executarSql(String sql) {
    EntityManager ent;
    ent = Persistence.createEntityManagerFactory("UP").createEntityManager();
    Query q = ent.createNativeQuery(sql);
    ent.getTransaction().begin();
    int r = q.executeUpdate();
    ent.getTransaction().commit();
    return r;
}
      public static void excluir (Object objeto) {
    // Dara erro com toplink e com campos not null do objeto no update!!!
    EntityManager ent;
    ent = Persistence.createEntityManagerFactory("UP").createEntityManager();
    ent.getTransaction().begin();
    //ent.remove(ent.getReference(Pessoa.class, objeto.getCodigo()));
    ent.remove(ent.merge(objeto)); // Erro com toplink e not null
    ent.getTransaction().commit();
  }

      public static void excluir (String pesquisa, String parametro, int chave) {
    EntityManager ent;
    ent = Persistence.createEntityManagerFactory("UP").createEntityManager();
    ent.getTransaction().begin();
    Query q = ent.createNamedQuery(pesquisa);
    q.setParameter(parametro, chave);
    Object objeto = q.getSingleResult();
    ent.remove(objeto);
    ent.getTransaction().commit();
  }
       public static void excluir (String pesquisa, String parametro, String chave) {
  EntityManager ent;
  ent = Persistence.createEntityManagerFactory("UP").createEntityManager();
  ent.getTransaction().begin();
  Query q = ent.createNamedQuery(pesquisa);
  q.setParameter(parametro, chave);
  Object objeto = q.getSingleResult();
  ent.remove(objeto);
  ent.getTransaction().commit();
}
    /* Nao implementado porque precisa da classe de origem
  public static Pessoa consultar (Pessoa objeto) {
    EntityManager ent;
    ent = Persistence.createEntityManagerFactory("UP").createEntityManager();
    objeto = ent.find(Pessoa.class, objeto.getCodigo()); // classe de origem
    return objeto;
  }
  */
    public static Object consultar (String pesquisa, String parametro, int chave) {
    EntityManager ent;
    ent = Persistence.createEntityManagerFactory("UP").createEntityManager();
    Query q = ent.createNamedQuery(pesquisa);
    q.setParameter(parametro, chave);
    Object objeto = q.getSingleResult();
    return objeto;
  }
  public static Object consultar (String pesquisa, String parametro, String chave) {
    EntityManager ent;
    ent = Persistence.createEntityManagerFactory("UP").createEntityManager();
    Query q = ent.createNamedQuery(pesquisa);
    q.setParameter(parametro, chave);
    Object objeto = q.getSingleResult();
    return objeto;
  }

}

xml da persistencia

<?xml version="1.0" encoding="UTF-8"?> oracle.toplink.essentials.PersistenceProvider to.Vacas [/code] desculpe eu nao sei como mandar o numero das linhas dos codigos

Rapaz… fica muito difícil de ler assim pq aparecem carinhas no meio do código, etc.

Edita a mensagem e coloca o código entre as tags code.

Blz tá editado!

Olha o XML:

<property name="toplink.jdbc.user" value="postgres"/>  
      <property name="toplink.jdbc.password" value=""/>  

Usuário “postgres” e senha vazia. É isso mesmo?

Provavelmente, colocando a informação correta nestes campos, o sistema funcionará.

como eu teria que colocar?