-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

1
  • Well, have you downloaded and put the Postgres JDBC driver on your class-path? Commented Dec 6, 2013 at 15:47

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.