4 Replies Latest reply on Sep 9, 2002 3:43 PM by erikture

    Image and Microsoft SQL server 2000

    erikture

      Hello!

      I am trying to use JBoss together with Microsoft SQL server 2000. My application works fine with both Hypersonic and mySQL.

      I have some attributes of type java.lang.Object, ie blobs, in wich I want to stor images, files or large texts. It works fine in Hypersonic and mySQL, but not with Microsoft SQL server 2000. JBoss creates the tables and creates rows of the type IMAGE. However when trying to create objects the JDBC driver says something about that it does not support the type IMAGE. I have looked around the net and found out other people with the same problem.

      Can I do something to get it to work or is it just to wait and see when Microsoft will support the IMAGE type in their driver?


      /Erik

        • 1. Re: Image and Microsoft SQL server 2000



          In the M$ JDBC Driver documentation, it talks about the SQL Server IMAGE data type mapping to Java VARLONGBINARY.

          Thus, you should be able to access an IMAGE column via getBytes. I would think you would need to change the type mappings in standardjbosscmp-jdbc.xml to do this, ie.


          <java-type>java.lang.Object</java-type>
          <jdbc-type>VARLONGBINARY</jdbc-type>
          <sql-type>IMAGE</sql-type>



          Let me know how you go - I have to do this soon!

          Cheers,

          Sherman

          • 2. Re: Image and Microsoft SQL server 2000
            erikture

            Hello!

            Unfortunatly the VARLONGBINARY jdbc type did not solve my problem. When creating the tables the follwoing error is shown:

            2002-09-09 18:36:44,227 WARN [org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCMappingMetaData] Unrecognized jdbc-type: VARLONGBINARY, using Types.OTHER
            java.lang.NoSuchFieldException
            at java.lang.Class.getField0(Native Method)
            at java.lang.Class.getField(Class.java:821)
            at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCMappingMetaData.getJdbcTypeFromName(JDBCMappingMetaData.java:41)
            at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCMappingMetaData.(JDBCMappingMetaData.java:70)
            at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCTypeMappingMetaData.(JDBCTypeMappingMetaData.java:99)
            at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCApplicationMetaData.(JDBCApplicationMetaData.java:202)
            at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCXmlFileLoader.load(JDBCXmlFileLoader.java:67)
            at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.loadJDBCEntityMetaData(JDBCStoreManager.java:677)
            at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.initStoreManager(JDBCStoreManager.java:389)
            at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManager.java:339)
            at org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManager.java:198)
            at org.jboss.ejb.EntityContainer.start(EntityContainer.java:376)
            at org.jboss.ejb.Container.invoke(Container.java:764)
            at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:1055)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
            at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:967)
            at $Proxy5.start(Unknown Source)
            at org.jboss.system.ServiceController.start(ServiceController.java:396)
            at java.lang.reflect.Method.invoke(Native Method)
            at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
            at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
            at $Proxy79.start(Unknown Source)
            at org.jboss.ejb.EjbModule.startService(EjbModule.java:430)
            at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:164)
            at java.lang.reflect.Method.invoke(Native Method)
            at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
            at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:967)
            at $Proxy5.start(Unknown Source)
            at org.jboss.system.ServiceController.start(ServiceController.java:396)
            at java.lang.reflect.Method.invoke(Native Method)
            at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
            at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
            at $Proxy9.start(Unknown Source)
            at org.jboss.ejb.EJBDeployer.start(EJBDeployer.java:394)
            at org.jboss.deployment.MainDeployer.start(MainDeployer.java:802)
            at org.jboss.deployment.MainDeployer.start(MainDeployer.java:794)
            at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:616)
            at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:580)
            at java.lang.reflect.Method.invoke(Native Method)
            at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
            at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
            at $Proxy4.deploy(Unknown Source)
            at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:427)
            at org.jboss.deployment.scanner.URLDeploymentScanner.scanDirectory(URLDeploymentScanner.java:648)
            at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:499)
            at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:261)
            at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:164)
            at java.lang.reflect.Method.invoke(Native Method)
            at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
            at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:967)
            at $Proxy0.start(Unknown Source)
            at org.jboss.system.ServiceController.start(ServiceController.java:396)
            at java.lang.reflect.Method.invoke(Native Method)
            at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
            at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
            at $Proxy3.start(Unknown Source)
            at org.jboss.deployment.SARDeployer.start(SARDeployer.java:249)
            at org.jboss.deployment.MainDeployer.start(MainDeployer.java:802)
            at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:616)
            at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:580)
            at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:564)
            at java.lang.reflect.Method.invoke(Native Method)
            at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
            at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:324)
            at org.jboss.system.server.ServerImpl.start(ServerImpl.java:221)
            at org.jboss.Main.boot(Main.java:142)
            at org.jboss.Main$1.run(Main.java:375)
            at java.lang.Thread.run(Thread.java:479)


            /Erik

            • 3. Re: Image and Microsoft SQL server 2000



              I mistyped. Try "LONGVARBINARY", not "VARLONGBINARY", as I had earlier...

              • 4. Re: Image and Microsoft SQL server 2000
                erikture

                Yes it works!

                Thanks!

                /Erik