Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2007
    Posts
    11

    Unanswered: db2java.zip - No suitable driver

    I'm trying to connect on a DB2 database using Java 1.4 with "COM.ibm.db2.jdbc.app.DB2Driver".
    The db2java.zip is correctly set on the CLASSPATH.

    When I try to connect using my Java Classfile, this error occurs:
    java.sql.SQLException: No suitable driver

    I've tried to put the db2java.zip into the /usr/java14_64/jre/lib/ext/db2java.zip and /usr/java14_64/lib/db2java.zip, with no success.
    I've also tried to execute my Java Classfile using the parameter -cp pointing to the db2java.zip path.

    When I try to connect using the "db2 connect to db user user using password", everything works fine.

    The S.O. is an AIX 5.3 with DB2 8.2.7.

    -r--r--r-- 1 bin bin 1246637 Nov 11 2006 /usr/opt/db2_08_01/java/db2java.zip

    What else can I do?

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    I'm not sure if Type 2 JDBC drivers are still supported. Why don't you use the JCC driver?

    What does your JDBC URL look like?
    ---
    "It does not work" is not a valid problem statement.

  3. #3
    Join Date
    Mar 2007
    Posts
    11

    My URL is:

    Code:
    public class TestaConexao {
        
    	  public static void main (String argv[])  {
    		  
    		  Connection conn = conectaBD("jdbc:db2:mydatabase", "myuser", "mypassword");
    		  desconectaBD(conn);
    		  
    	  }
    		
    	  public static Connection conectaBD(String url, String usuario, String senha) {	
    		  String Driver = new String("COM.ibm.db2.jdbc.app.DB2Driver");	
    		  Connection conn = null;
    		  try {
    			  Class.forName(Driver);
          			conn = DriverManager.getConnection(url, usuario, senha);
          		}
          		catch (Exception e) {
          			System.out.println("Ocorreu erro: " + e.toString());
          			System.exit(0);
          		}
          		return conn;
    	  }
     
    	  public static void desconectaBD(Connection conn) { 
    		  try {
    			  conn.commit();
    			  conn.close();
    		  }
    		  catch (Exception e) {
    			  System.out.println("Ocorreu erro: " + e.toString());
    			  System.exit(0);
    		  }
    	}
    }
    Where can I get the jcc driver?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •