If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > db2java.zip - No suitable driver

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-27-07, 13:41
Shyckymn Shyckymn is offline
Registered User
 
Join Date: Mar 2007
Posts: 11
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?
Reply With Quote
  #2 (permalink)  
Old 09-27-07, 16:18
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
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?
Reply With Quote
  #3 (permalink)  
Old 10-01-07, 06:09
Shyckymn Shyckymn is offline
Registered User
 
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?
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On