3 Replies Latest reply on Feb 7, 2014 3:48 PM by chubutin

    Fuse ESB - MSSQL Drivers

    Milan Milas Newbie

      Hi,

       

      I've found discussion on this forum about making SQLServer Drivers to work in ESB.

       

      I have tried:

      Wrap driver jar file .m2 maven repository and install it

      mvn install:install-file -Dfile=sqljdbc4.jar -Dpackaging=jar -DgroupId=com.microsoft.sqlserver -DartifactId=sqljdbc4 -Dversion=4.0

      install -s mvn:com.microsoft.sqlserver/sqljdbc4/4.0

      or

      copy jar file in deploy folder

      or

      Try to modify sqljdbc4-4.0.jar file with proper METAINF.MF informations

      (installing file using install -s mvn or if I just copy file to deploy folder does not give same results on FUSE dashboard)

       

      I have as well created bundle that should import it to JDBC bundle as suggested

      MANIFEST.MF

      Manifest-Version: 1.0

      Bnd-LastModified: 1371049527413

      Build-Jdk: 1.7.0

      Built-By: milan.milas

      Bundle-ManifestVersion: 2

      Bundle-SymbolicName: mssql-fragment

      Bundle-Version: 1.0.0

      Fragment-Host: org.springframework.jdbc

      Bundle-Name: XXX:: MSSQL Fragment :: SQL Driver

      Bundle-Description: Sample Bundle export

      Import-Package: com.microsoft.sqlserver.jdbc

       

      pom.xml

       

       

      I am still getting error in my bundle, exception on jdbc class that it not able to find SQL class.

      I can see that jdbc has imported sql server driver but version is 0.0.0 (attachment),

      I think this is the issue, and I was not able to change version of jdbc driver during wrapping

       

      Caused by: java.lang.IllegalStateException: Could not load JDBC driver class

           at org.springframework.jdbc.datasource.DriverManagerDataSource.setDriverClassName(DriverManagerDataSource.java:150)[403:org.springframework.jdbc:3.0.7.RELEASE]

        • 1. Re: Fuse ESB - MSSQL Drivers
          Ramzy JELASSI Newbie

          Hi there,

           

          i am interested in the solution if this was fiwed!

          any feedback?

           

          regards,

          • 2. Re: Fuse ESB - MSSQL Drivers
            Santhosh Kumar Newbie

            Try with the below data source, it works:

             

             

            • 3. Re: Fuse ESB - MSSQL Drivers
              chubutin Newbie

              Hi! I use SQL and MYSQL in my services and they work great!

               

              You should install them into de OSGi container. MySQL provides a Bundle for the driver, but MySQL doesn't.

               

              You need the features: jpa

               

              And install thw drivers with this command

               

              osgi:install mvn:mysql/mysql-connector-java/5.1.18

              osgi:install wrap:mvn:com.microsoft.sqlserver/sqljdbc4/4.0

               

              With this you should have the bundles with the correct export/import package inside your karaf context. So if you put inside your Import-package the classes you need, they will found it inside the OSGi register (this is with the maven-bundle-plugin)

               

               

                        <property name="URL" value="$" />

                        <property name="user" value="$" />

                        <property name="password" value="$" />

              </bean>

               

              The class OSGiDataSource is an extension of com.microsoft.sqlserver.jdbc.SQLServerDataSource so I can export it in the OSGi register as a unique service

               

              The export service

               

              <osgi:service id="osgiDataSource" ref="dataSource"

                        interface="javax.sql.DataSource" />

               

              And the import service

               

              <osgi:reference id="osgiDataSource"

                        interface="javax.sql.DataSource"/>

               

               

              Hope this can help you!