-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Middlegen can't find tables in MS SQLServer
PostPosted: Fri Apr 15, 2005 1:01 pm 
Newbie

Joined: Fri Apr 15, 2005 12:35 pm
Posts: 1
I'm running Middlegen (v2.1) against Microsoft SQLServer. Middlegen connects fine, but says it can't find any tables. When I run the Middlegen IDE in RAD, it even lists all the tables I need, but when I select one (or several) and hit "Run," it says it can't find any tables in the database. It's sending the following SQL to the database:
Code:
exec []..sp_tables NULL, N'', N'', NULL


The DB complains of a syntax error. I've tried using JTDS and Microsoft's JDBC driver and got the same error both times. It seems that including the database name in the brackets solves the syntax error:
Code:
exec [MY_DB]..sp_tables NULL, N'', N'', NULL


However, it still returns an empty result set. The SQL should actually be:
Code:
exec [MY_DB]..sp_tables NULL, NULL, NULL, NULL


I've tried specifying the DB in the URL or leaving it out, I've tried specifying or leaving out the schema and catalog in the Ant task, I've tried specifying or leaving out tables, I've tried logging in as a different user, and I've tried all combinations of the above.

Here's my basic Ant script:
Code:
<project name="Middlegen Test" default="all" basedir=".">
   <path id="classes">
      <fileset dir="..">
         <include name="**/*.jar"/>
      </fileset>
   </path>
   <taskdef name="middlegen" classname="middlegen.MiddlegenTask" classpathref="classes"/>

   <target name="init">
      <tstamp/>
   </target>

   <target name="all" depends="init, create-mapping"/>

   <target name="create-mapping">
      <middlegen
         appname="middlegen-test"
         prefsdir=".middlegen"
         gui="true"
         username="MY_USER"
         password="MY_PASSWORD"
         databaseurl="jdbc:jtds:sqlserver://MY_SERVER:MY_PORT/MY_DB"
         driver="net.sourceforge.jtds.jdbc.Driver">

         <!-- Plugins -->
         <hibernate
            destination="."
            package="test.hibernate"
            javaTypeMapper="middlegen.plugins.hibernate.HibernateJavaTypeMapper"
            genXDocletTags="true"/>
      </middlegen>
   </target>
</project>


Any ideas?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 15, 2005 10:30 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
I have it talking to MS SQL server with no issues using the jTDS driver (old one but it works well enough for what I need). From memory I had to include the schema and catalog settings.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.