facebook

MS SQL Server and Database Explorer (and Hibernate)

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

    bradm
    Member

    Any progress on the inability to make a successful connection to a Microsoft SQL Server db with the Database Explorer GUI? Myself and others have questioned this before here, and there’s never been a satisfactory answer.

    Any attempt to login using a DB Explorer connection results in the same generic message: “Error while trying to log into database. com.microsoft.jdbc.sqlserver.SQLServerDriver.” The login info I’m using works perfectly fine if I hard wire a connection in code, and even the Database Explore will connect if I use that same connection info in an ODBC DSN. That suggests to me that the problem lies in the Database Explorer somewhere (correct me if I’m missing something, please!)

    The reason this is important to me is that I’d like to use the Database Explorer’s automatic Hibernate mapping.

    It was suggested once (here) that I use the alternative third party driver (whose name escapes me now). I did, with the same results. Please advise: this has been a problem for a long time, and I have no choice other than SQL Server at my disposal.

    #229607 Reply

    Riyad Kalla
    Member

    Myself and others have questioned this before here, and there’s never been a satisfactory answer.

    The MS driver can either be unzipped and repackaged into a single ZIP file, OR you can use the jTDS driver (which most people fine faster/more functional/stable than the MS Driver).

    It was suggested once (here) that I use the alternative third party driver (whose name escapes me now). I did, with the same results. Please advise: this has been a problem for a long time, and I have no choice other than SQL Server at my disposal.

    I assure you the jTDS driver works fine, the reason the MS driver fails so miserably is that the DB Explorer is trying to instantiate a copy of the java.sql.Driver class to connect to the DB, the way MS packages their driver is to have a base Abstract extension of java.sql.Driver in one JAR, and then they provide the concrete driver implementation in another JAR, the DB Explorer is unable to tell that the driver it want’s is an extension of java.sql.Driver and ends up thinking there isn’t on. This IS a bug, and IS filed to be fixed.

    #229867 Reply

    Chris Parsons
    Participant

    I am trying out the Hibernate functionality, and am following the documentation to create a hibernate mapping for an MS SQL table – connected with jTDS as suggested, and the mapping created contains an error – not sure why, as the syntax of the mapping file looks ok to me!

    <?xml version="1.0"?>
    <!DOCTYPE hibernate-mapping PUBLIC
                                "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
                                "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
    
    <!-- DO NOT EDIT: This is a generated file that is synchronized -->
    <!-- by MyEclipse Hibernate tool integration.                   -->
    <!-- Created Thu May 19 16:48:34 BST 2005                         -->
    <hibernate-mapping package="uk.gov.torbay.cram.hibernate">
    
        <class name="Organisation" table="organisation">
     
            <property name="id" column="id" type="java.lang.Integer"  not-null="true" />
            <property name="name" column="name" type="java.lang.String" />
    
        </class>
        
    </hibernate-mapping>

    The error is that the ‘class’ element is badly formed, not sure why!

    As this is automatically generated I am not sure what I can do about it?

    Any ideas?

    Chris

    #229868 Reply

    Riyad Kalla
    Member

    Chris,
    The problem is you are missing an “id” for the class, this is likely caused by mapping a table that does not have a PK, all tables that are mapped must contain a PK.

    #229951 Reply

    Chris Parsons
    Participant

    Thanks – yes, that did the trick, looks pretty good

    Do you know of any other tutorials other than the ‘slide show’?

    Regards

    Chris

    #229960 Reply

    Riyad Kalla
    Member

    Sure, under Documentation > Advanced, you can get to it, here is a direct link:
    http://www.myeclipseide.com/images/tutorials/quickstarts/hibernate/

    #230028 Reply

    bradm
    Member

    Just for the record, I used Database Explorer to register a new driver; pointed it to the 3 .jars Microsoft requires, and got on without a hitch. Been using it for 2 weeks: here’s hoping!

Viewing 7 posts - 1 through 7 (of 7 total)
Reply To: MS SQL Server and Database Explorer (and Hibernate)

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