facebook

DB2 Type 2 – Hibernate/Generating Artifacts ERROR

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

    Hi,

    Current System:
    Eclipse 3.1.2
    MyEclipse EnterpriseWorkbenchInstaller_4.1.1GA_E3.1

    Im using the IBM DB2 APP Template
    And using the client db2java.zip file (Type 2)
    NOTE: Using the Type 4 works, but we want to use Type 2
    Any suggenstions?

    This is the error in the log:

    !ENTRY org.eclipse.core.runtime 4 2 2006-04-07 15:09:59.712
    !MESSAGE An internal error occurred during: “Generating Artifacts”.
    !STACK 0
    java.lang.AbstractMethodError: COM.ibm.db2.jdbc.app.DB2DatabaseMetaData.supportsResultSetType(I)Z
    at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:80)
    at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1877)
    at com.genuitec.eclipse.hibernate.wizards.MEJDBCMetaDataConfiguration.readFromJDBC(MEJDBCMetaDataConfiguration.java:71)
    at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob$5.execute(GenerateArtifactsJob.java:405)
    at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:35)
    at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:68)
    at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob.buildConfiguration(GenerateArtifactsJob.java:400)
    at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob.run(GenerateArtifactsJob.java:266)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:76)

    #250033 Reply

    Riyad Kalla
    Member

    Since the type of driver you are using at deployment is independent of the type of driver you use to generate artifcats, why not use the Type 4 driver inside of MyEclipse when generating artifacts?

    #250035 Reply

    Haris Peco
    Member

    felipeg ,

    What is your OS, database and driver version ?
    Do you can open connection in DB Explorer with type 2 ?
    Type 2 driver work in ME 4.1.1, but it tested on linux and ms windows, only

    Do you try with db2 universal drivers – jar files for type2 and type4 are same and different is url (jdbc:db2:DATABASE for type 2)

    Thanks

    #250042 Reply

    >> What is your OS, database and driver version ?

    Im using Windows XP Profesional, And Im using DB2 version 7 and 8 with the 7.2Driver

    >> Do you can open connection in DB Explorer with type 2 ?

    Yes, the DB Explorer is working with type 2 driver.

    >> Do you try with db2 universal drivers – jar files for type2 and type4 are same and different is url (jdbc:db2:DATABASE for type 2)

    Yes, actually Im using that url: jdbc:db2:<DATAASE>

    There is an ISQL application (AQT) with these drivers.

    And actually, when I select the last options at the last step of the wizard (with the check boxes, about Table References) it crash with some error number.

    Thanks for your support.

    #250057 Reply

    Haris Peco
    Member

    This is problem with your driver

    from your log : method ‘COM.ibm.db2.jdbc.app.DB2DatabaseMetaData.supportsResultSetType’ is standard JDBC method and your driver return error (hibernate ask your driver if support scrollable resultset and your driver throw exception)

    You can try upgrade jdbc driver (if it possible because your db2 ver 7) – you can try jdbc 8 (type 2) with database 8 and you will see that it work fine

    you can try next test (with type 2 and type 4) – i comment code which fail

    
    import java.sql.Connection;
    import java.sql.DatabaseMetaData;
    import java.sql.Driver;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.util.Properties;
    
    import junit.framework.TestCase;
    
    public class Db2Type2ResultSetTest extends TestCase {
    
        // this is type 2 driver
        private String driverName = "COM.ibm.db2.jdbc.app.DB2Driver";
        // this is universal driver
        //private String driverName =
        //    "com.ibm.db2.jcc.DB2Driver";
        
        private String url = "jdbc:db2:YOUR_DATABASE";
        
        private String username = "YOUR_USERNAME";
    
        private String password = "YOUR_PASSWORD";
        private static Driver driver;
    
        public Db2Type2ResultSetTest(String name) {
            super(name);
            if (driver == null) {
                try {
                    driver = (Driver) Class.forName(driverName).newInstance();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
    
        protected void setUp() throws Exception {
            super.setUp();
        }
    
        protected void tearDown() throws Exception {
            super.tearDown();
        }
    
        //  test
        public void testType2() {
            Connection connection = null;
            try {
                connection = getConnection();
                DatabaseMetaData meta = connection.getMetaData();
                // this is failed hibernate call 
                boolean upportsScrollable = meta.supportsResultSetType(ResultSet.TYPE_SCROLL_INSENSITIVE);
            } catch (SQLException e) {
                e.printStackTrace();
                fail();
            } finally {
                try {
                    if (connection != null)
                        connection.close();
                } catch (SQLException e) {}
            }
        }
    
        public Connection getConnection() throws SQLException {
            Properties props = new Properties();
            props.setProperty("user", username);
            props.setProperty("password", password);
            return DriverManager.getConnection(url, props);
        }
        
    }
    

    Best

    PS
    (just curious) what is reason that you favorite type2 driver ?

    #250065 Reply

    Thanks for your support

    Well, actually I tryed to convince my company
    to get MyEclipse

    And they are using some standards, so they still using those drivers, I dont know why.

    But thanks for your help.

    #250066 Reply

    Haris Peco
    Member

    felipeg,

    type 2 drivers work with MyEclipse, but I suppose that you have buggy jdbc driver
    I send you test and you can start test out of MyEclipse and see if it work – i suppose that it will
    work with type 4 and newer (at least ver 8.1) type 2
    We test latest type 2 jdbc with db2 8 on windows and linux

    Type 2 driver use native (non java code) and i suppose that it can be security reason.Type 2 vendors claim that type 2 is quicker, but i don’t see that it’s true (database speed is crtical at all).
    However, type 2 doesn’t work in network environment and it is big disadvantage for this driver

    Best

Viewing 7 posts - 1 through 7 (of 7 total)
Reply To: DB2 Type 2 – Hibernate/Generating Artifacts ERROR

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