-3

class conextion in java:

     try {

             Class.forName("org.postgresql.Driver");
             Properties props = new Properties();
             props.setProperty("user","postgres");
             props.setProperty("password","postgres");
             Connection conn = DriverManager.getConnection(url, props);
             String stsql = "SELECT * From mercarderia";
             Statement st = conn.createStatement();
             ResultSet rs = st.executeQuery(stsql);

             while (rs.next()) {
                       String c = rs.getString("nombre");
                       System.out.println(c);

             }
             conn.close();
             } catch (SQLException se) {
             System.out.println("oops! No se puede conectar. Error: " + se.toString()+se.getErrorCode());
             msj.setText("oops! No se puede conectar. Error: " + se.toString() + "||" +se.getErrorCode());
             } catch (ClassNotFoundException e) {
                 System.out.println("oops! No se encuentra la clase. Error: " + e.getMessage() +" "+ e.getException());
             msj.setText("oops! No se encuentra la clase. Error: " + e.getMessage());
             }
}

I get:

Error: java.lang.NoClassDefFoundError: org.postgresql.Driver

pls help... postgresql version 9.3
*JDK 1.8
Eclipse and SDK oficial*

Now I get the following error message: java.lang.VerifyError: org.postgresql.Driver and the driver is in the "libs" folder

  • Well, have you downloaded and put the [Postgres JDBC driver](http://jdbc.postgresql.org/download.html) on your class-path? – Chris Mantle Dec 06 '13 at 15:47

1 Answers1

0

You should check if your postgres driver library is in your buildpath, and if so also enable its export in the application. This is a duplicate of JDBC postgresql driver not found in android project

Community
  • 1
  • 1