facebook

[Closed] create hibernate mapping error(database is DB2)?

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #246860 Reply

    augustfox
    Member

    myeclipse 4.1GA.
    when open DB Browser and select a table,nothing is incorrect,
    but when execute “Create Hibernate Mapping”,error happens.
    The error message is:An internal error occurred during:”Generating Artifacts”.

    what in the log(.metadata\log):
    !ENTRY org.eclipse.core.runtime 4 2 2006-02-16 10:35:49.694
    !MESSAGE An internal error occurred during: “Generating Artifacts”.
    !STACK 0
    org.hibernate.console.HibernateConsoleRuntimeException: Problems while loading database driverclass (COM.ibm.db2.jdbc.app.DB2Driver)
    at org.hibernate.console.ConsoleConfiguration.registerFakeDriver(ConsoleConfiguration.java:243)
    at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob$5.execute(GenerateArtifactsJob.java:392)
    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:388)
    at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob.run(GenerateArtifactsJob.java:255)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:76)
    Caused by: java.sql.SQLException: java.lang.UnsatisfiedLinkError: Native Library D:\Program Files\SQLLIB\bin\db2jdbc.dll already loaded in another classloader
    at COM.ibm.db2.jdbc.app.DB2Driver.<init>(DB2Driver.java:294)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
    at java.lang.Class.newInstance0(Class.java:308)
    at java.lang.Class.newInstance(Class.java:261)
    at org.hibernate.console.ConsoleConfiguration.registerFakeDriver(ConsoleConfiguration.java:228)
    … 6 more

    when change to 4.0.3,all work perfect.
    i have searched the forums,but can not get over it.

    any help is appreciated,thans for all.

    #246861 Reply

    augustfox
    Member

    maybe the problem is type 2 and type 4 drive,but i am using db2 7.2,
    it has not type 4 driver,what should i do?

    #246863 Reply

    Brian Fernandes
    Moderator

    augustfox,

    Yes, the problem is the type 2 driver. We have fixed this internally and the fix will be released in 4.1.1 which is due by the end of Feb.
    Sorry for the inconvenience caused.

    In the meanwhile, I think the Universal Type 4 driver does work for 7.2, could you try the following steps and see if it works for you?

    1) Download and unzip this file: DB2 Type 4 Driver
    2) Add all the JAR files in the zip to a new driver configuration
    3) The driver class name should be com.ibm.db2.jcc.DB2Driver
    4) For the connection URL in the profile, use something like jdbc:db2://localhost:<port>/<dbname>.

    You will need to connect to your database using this driver instead for Reverse engineering to work. Please let us know how it turns out or if you require further assistance.

    Best,
    Brian.

    #246865 Reply

    augustfox
    Member

    thanks, Brian:
    i followed your advice,
    i copy db2jcc.jar,db2jcc_license_cu.jar and all jar files to the Driver jars,
    driver class is com.ibm.db2.jcc.DB2Driver;
    url is jdbc:db2://localhost:50000/test
    but it still gives errors.
    the error as follows:

    !ENTRY com.genuitec.eclipse.sqlexplorer 4 4 2006-02-16 17:21:25.776
    !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:534)

    is anything I done wrong?
    thanks!

    #246870 Reply

    Riyad Kalla
    Member

    Do you have a firewall running on the machine you are trying to connect to that could be blocking incomming connections on port 50k?

    #246884 Reply

    Haris Peco
    Member

    Augustfox,

    Your settings look good. but try log with simple application from this thread, please http://myeclipseide.com/PNphpBB2+file-viewtopic-t-11228.html
    and send us error log if don’t success

    Best

    #246917 Reply

    augustfox
    Member

    with simple application still has errors.
    the error is like this:

    java.sql.SQLException: No suitable driver
    at java.sql.DriverManager.getConnection(DriverManager.java:532)
    at java.sql.DriverManager.getConnection(DriverManager.java:193)
    at demo.hibernate.TestDriver.main(TestDriver.java:16)

    then i search the DB2 docs,it says DB2 7.2 only support type1,2,3 driver,but not support type 4 driver.

    looking forward your team can settle this in ME4.1.1,after all 7.2 version is still very popular.
    thanks.

    #246924 Reply

    Brian Fernandes
    Moderator

    augustfox,

    There is some confusion out there regarding what versions of DB2 support the type 4 driver. We are trying to setup a DB2 7.x server internally to run a few tests ourselves.
    I will agree when you say it is very popular 🙂

    The good news is that the Reverse Engineering support for type 2 drivers has already been added to 4.1.1, something might be out by next week and we hope you can give it a test run then.

    We appreciate your patience and support, sorry for the inconvenience caused.
    Thanks,
    Brian.

    #251992 Reply

    little_qd
    Member

    myeclipse 4.1.1
    driver “COM.ibm.db2.jdbc.app.DB2Driver”
    type2:” jdbc:db2:database”
    still has errors:java.sql.SQLException: No suitable driver
    ???

    #251993 Reply

    Haris Peco
    Member

    little_qd ,

    ‘no suitable driver’ mean that driver manager can’t recognize your URL – URL is good (if you have database ‘database’) and you haven’t correct libraries

    Please, do next in MyEclipse 4.1.1

    – remove driver and connection profile
    – restart eclipse/MyEclipse
    – add driver and connection profile again

    Restart i snecessary, because JVM can’t load native (type 2) libraries twice

    Thanks

    #251994 Reply

    little_qd
    Member

    1、copy db2java.jar to web-inf/lib
    2、web project – bulidpath – add db2java.jar
    3、ME – app server – tomcat 5 – prepend classpath – add db2java.jar
    4、start tomcat in ME
    errors: ‘no suitable driver’ what’s wrong?

    1、use the same jar and setting in java,run in eclipse ,that’s no error.
    2、copy db2java.jar to TOMCAT_HOME\common\lib,start tomcat not in ME,that’s no error too.
    apologize for my poor English 🙂

    thanks!

    #251995 Reply

    Haris Peco
    Member

    Please, try make connection profile, first and then set tomcat

    You have add license library for your environment (probably db2jcc_license_cu.jar)
    Read description your driver and add other libraries if exists

    Best regards

    #251997 Reply

    little_qd
    Member

    copy db2jdbc.dll to jdk/bin/
    all is ok!!

    #251998 Reply

    Haris Peco
    Member

    It’s great.I’m glad for your success

    Best regards

Viewing 14 posts - 1 through 14 (of 14 total)
Reply To: [Closed] create hibernate mapping error(database is DB2)?

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