facebook

Error connecting to DB2 8.2 Database using Database Explorer

  1. MyEclipse Archived
  2.  > 
  3. Database Tools (DB Explorer, Hibernate, etc.)
Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #250507 Reply

    Eclipse Version 3.1.2 / MyEclipse Version 4.1.1 / Java 5.0 Update 6.

    I can successfully connect using a simple test application listed below:

    =============================
    import java.sql.DriverManager;
    import java.sql.SQLException;

    public class TestDriver {

    private static String driverName = “com.ibm.db2.jcc.DB2Driver”;
    private static String url = “jdbc:db2://127.0.0.1:50000/MYDB”;

    public static void main(String[] args) {
    try {
    Class.forName(driverName);
    DriverManager.getConnection(url, “mydb2guru”, “mydb2guru”);
    } catch (ClassNotFoundException e) {
    e.printStackTrace();
    System.exit(1);
    } catch (SQLException e) {
    e.printStackTrace();
    System.exit(1);
    }

    System.out.println(“Connection is fine”);
    }
    }
    =============================

    My project classpath contains:
    – db2java.zip
    – db2jcc.jar
    – db2jcc_license_cu.jar

    Same files are also available in Driver Definition however Database Explorer of MyEclipseIDE fails to connect to the database throwing the infamos and (may I say, not very helpful?) message listed below:

    !ENTRY com.genuitec.eclipse.sqlexplorer 4 4 2006-04-14 23:09:20.546
    !MESSAGE Error while trying to login to database
    !STACK 0
    java.sql.SQLException: Unable to create connection. Check your URL.
    at net.sourceforge.squirrel_sql.fw.sql.SQLDriverManager.getConnection(SQLDriverManager.java:102)
    at com.genuitec.eclipse.sqlexplorer.actions.LoginProgress$Login.run(LoginProgress.java:43)
    at java.lang.Thread.run(Thread.java:536)

    !ENTRY com.genuitec.eclipse.sqlexplorer 4 4 2006-04-14 23:11:57.859
    !MESSAGE Error while trying to login to database
    !STACK 0
    java.sql.SQLException: Unable to create connection. Check your URL.
    at net.sourceforge.squirrel_sql.fw.sql.SQLDriverManager.getConnection(SQLDriverManager.java:102)
    at com.genuitec.eclipse.sqlexplorer.actions.LoginProgress$Login.run(LoginProgress.java:43)
    at java.lang.Thread.run(Thread.java:536)

    I have been able to use Database Explorer in past and I can still use it with MySQL – just not with DB2. Can anybody shed some light on this subject?

    Thanks much.

    #250511 Reply

    Haris Peco
    Member

    mnamdeo,

    What is your database version and OS (where database is). ?
    It looks that you set driver correct and it is possible driver/database mismatch (your driver version doesn’t
    work with your database version)

    Double check your jars – if it work from simple application it must work from MyEclipse – MyEclipse use same
    call for open connection

    You needn’t db2java.zip for type 4 driver (your url and class is type 4)

    It is possible that you have defined other db2 driver which conflict with this driver – check driver configuration for
    other bloated driver and remove all unecessary drivers and connection profile (if you have some)

    Best

    #250519 Reply

    Database is DB2 8.2 on Windows XP. Driver / database mismatch may not be the case since I can connect fine from code, just not from Database Explorer. Does MyEclipse conflict with db2java.zip in system classpath? DB2 is installed on the same machine as MyEclipse and it added db2java.zip in classpath.

    I will try with just the following:
    Drivers:
    – db2jcc.jar
    – db2jcc_license_cu.jar

    driverName = “com.ibm.db2.jcc.DB2Driver”;
    url = “jdbc:db2://127.0.0.1:50000/MYDB”;

    #250520 Reply

    No success with type 4 configuration listed in my previous post. Coould this be the cause? Unable to locate .myeclipse.properties? Does the database explorer work in trial period?

    !ENTRY com.genuitec.eclipse.core 1 0 2006-04-15 07:53:48.953

    !MESSAGE Unable to locate .myeclipse.properties file

    !ENTRY com.genuitec.eclipse.sqlexplorer 4 4 2006-04-15 07:53:51.312
    !MESSAGE Error while trying to login to database
    !STACK 0

    java.sql.SQLException: Unable to create connection. Check your URL.
    at net.sourceforge.squirrel_sql.fw.sql.SQLDriverManager.getConnection(SQLDriverManager.java:102)
    at com.genuitec.eclipse.sqlexplorer.actions.LoginProgress$Login.run(LoginProgress.java:43)
    at java.lang.Thread.run(Thread.java:536)

    #250523 Reply

    Riyad Kalla
    Member

    added db2java.zip in classpath.

    Remove this from your system classpath and restart MyEclipse, see if that works.

    Unable to locate .myeclipse.properties? Does the database explorer work in trial period?

    If you go into your User Home directory (On windows it is under C:\Documents and Settings\<user name> and create an empty file called .myeclipse.properties, that should fix that problem. And yes, it works in Trial version (everything works in Trial).

    #250529 Reply

    Haris Peco
    Member

    mnamdeo,

    Your error is because driver manager (java) return null when you try connection
    You claim that it work in simple test and if you have same settings then you have other driver in other connection profile or driver configuration and this driver isn’t compatible (MyEclipse load all drivers classes and Java engine try connect with first driver which accept url)

    Try Windows-Properties-MyEclipse-Database Explorer-Drivers

    Remove all db2 drivers (drivers for other databases isn’t problem, but it can be good that remove all drivers if it possible)

    configure db2 driver again
    restart eclipse/MyEclipse
    make connection profile for db2 with your parameters

    Best

    #252114 Reply

    MikeB_dw93f
    Member

    I just installed MyEclipse today and am having the exact same problem as mnamdeo using a similar configuration, DB2 8.2 but Java 1.4.2 . Maybe this will be a hint as to what is going on – I see that DB Exploerer uses Squirrel. I also have Squirrel Sql istalled on my machine and I’ve never been able to get that to connect to the database, although DB2 client and java apps connect fine.

    #252115 Reply

    Haris Peco
    Member

    It’s strange.
    We don’t use anything special – if simple java app work then db explorer have to work

    Please, double check your driver and URL – you can try simple app with wrong url and you will get same error

    Thanks

    Notes : Is your version express (viper) or … ?

    #252117 Reply

    MikeB_dw93f
    Member

    My mistake… I was missing the : following db2 in the url jdbc:db2://host

    It’s working now! Thanks

    #252131 Reply

    MikeB_dw93f
    Member

    Found the problem cause… The IBM DB2 App Driver template when creating a new driver has the following URL template

    jdbc:db2//<host_name>:6789/<dbname>

    Which is missing the : following db2. It should be

    jdbc:db2://<host_name>:6789/<dbname>

    #252133 Reply

    Riyad Kalla
    Member

    I confirmed this and will file it as a bug, thanks for the heads up.

Viewing 11 posts - 1 through 11 (of 11 total)
Reply To: Error connecting to DB2 8.2 Database using Database Explorer

You must be logged in to post in the forum log in