4 Replies Latest reply on Jan 12, 2007 8:53 PM by Norman Richards

    use seam gen to connect to mssql server

    Joan Xiong Newbie

      Hi all,
      i used seam gen to generate a new seam project for my application. in the seam gen setup dialog, i wanted to directly connect to mssql server, i am VERY POSITIVE that i used the right driver class and right connection url, but i can NEVER connect to sql server directly.
      HOWEVER, if i tried to connect to hypersonic database first, then modify the ds.xml file so that it will connect to mssql server, then it WORKED.

      has anybody anywhere mentioned that using seam gen you can only connect to hypersonic database first? and NOT DIRECTLY to other database? the only way to connect to other databases is to modify the ds.xml file? this is my experience anyway using seam gen.

      it does not make any sense this way, so please somebody could answer this question,

      many thanks, Joan

        • 1. Re: use seam gen to connect to mssql server
          Norman Richards Master

          Can you show the seam-generated ds.xml and your hand-generated one?

          • 2. Re: use seam gen to connect to mssql server
            Joan Xiong Newbie

            thanks for the reply:
            seam-gen generated ds.xml
            -----------------
            <?xml version="1.0" encoding="UTF-8"?>


            <local-tx-datasource>
            <jndi-name>ndpjDatasource</jndi-name>
            <connection-url>jdbc:hsqldb:.</connection-url>
            <driver-class>org.hsqldb.jdbcDriver</driver-class>
            <user-name>sa</user-name>

            <!--
            <exception-sorter-class-name>
            org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter
            </exception-sorter-class-name>

            <type-mapping>mySQL</type-mapping>

            -->
            </local-tx-datasource>


            -----------------------------
            then i modified this ds.xml to connect to mssql server
            <?xml version="1.0" encoding="UTF-8"?>


            <local-tx-datasource>
            <jndi-name>ndpjDatasource</jndi-name>
            <connection-url>jdbc:jtds:sqlserver://localhost:1433;DatabaseName=ndpj;SelectMethod=cursor</connection-url>
            <driver-class>net.sourceforge.jtds.jdbc.Driver</driver-class>
            <user-name>sa</user-name>
            sa
            <!--
            <exception-sorter-class-name>
            org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter
            </exception-sorter-class-name>

            <type-mapping>mySQL</type-mapping>

            -->
            </local-tx-datasource>


            --------------
            it ONLY work when you connect to hypersonic db first, then modify the ds.xml to connect to sql server, it will NOT work if you use seam gen directly connect to mssql server!!!
            strange.

            • 3. Re: use seam gen to connect to mssql server
              Tino Nitze Newbie

              Well, all i can say is that it worked for me :).
              Does it not even generate the ds or is the generated one not working?

              • 4. Re: use seam gen to connect to mssql server
                Norman Richards Master

                Can you please show the seam-generate ds.xml that is failing to connect to MSSQL?