论坛首页 Java企业应用论坛

解决了我请客吃饭。sqlserver数据库的Blob无法解决读出问题。

浏览 6162 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2004-03-12  
我查了很多文档,也许是我理解力不够吧!总是解决不了。

   我有图片打算存储。在java文件中是java.sql.Blob。hbm中是blob.
存储没有问题。可是一查询就立马报错。

   解决者在北京,我请客吃饭。快疯了。  

Hibernate: select images0_.id as id__, images0_.fileId as fileId__, images0_.id as id0_, images0_.name as name0_, images0_.content as content0_, images0_.fileId as fileId0_ from image images0_ where images0_.fileId=?

10:48:36,687  WARN JDBCExceptionReporter:38 - SQL Error: 0, SQLState: HY000

10:48:36,687 ERROR JDBCExceptionReporter:46 - [Microsoft][SQLServer 2000 Driver for JDBC]Unsupported data conversion.

10:48:36,703  WARN JDBCExceptionReporter:38 - SQL Error: 0, SQLState: HY000

10:48:36,718 ERROR JDBCExceptionReporter:46 - [Microsoft][SQLServer 2000 Driver for JDBC]Unsupported data conversion.

10:48:36,750 ERROR JDBCExceptionReporter:38 - could not initialize collection: [com.pkpm.right.rightArchive.File.images#1]

java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Unsupported data conversion.

at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)

at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)

at com.microsoft.jdbc.base.BaseData.unsupportedConversion(Unknown Source)

at com.microsoft.jdbc.base.BaseData.getBlob(Unknown Source)

at com.microsoft.jdbc.base.BaseResultSet.getBlob(Unknown Source)

at com.microsoft.jdbc.base.BaseResultSet.getBlob(Unknown Source)

at net.sf.hibernate.type.BlobType.get(BlobType.java:32)

at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:62)

at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:53)

at net.sf.hibernate.type.AbstractType.hydrate(AbstractType.java:66)

at net.sf.hibernate.loader.Loader.hydrate(Loader.java:610)

at net.sf.hibernate.loader.Loader.loadFromResultSet(Loader.java:551)

at net.sf.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:510)

at net.sf.hibernate.loader.Loader.getRow(Loader.java:425)

at net.sf.hibernate.loader.Loader.doQuery(Loader.java:208)

at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:132)

at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:909)

at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:884)

at net.sf.hibernate.loader.OneToManyLoader.initialize(OneToManyLoader.java:80)

at net.sf.hibernate.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:284)

at net.sf.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:3133)

at net.sf.hibernate.collection.PersistentCollection.forceInitialization(PersistentCollection.java:331)

at net.sf.hibernate.impl.SessionImpl.initializeNonLazyCollections(SessionImpl.java:3007)

at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:137)

at net.sf.hibernate.loader.Loader.doList(Loader.java:949)

at net.sf.hibernate.loader.Loader.list(Loader.java:940)

at net.sf.hibernate.hql.QueryTranslator.list(QueryTranslator.java:833)

at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1475)

at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1454)

at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1450)

at com.pkpm.right.rightArchive.Manager.getPack(Manager.java:372)

at org.apache.jsp.archive$jsp._jspService(archive$jsp.java:134)

at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:201)

at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)

at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)

at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)

at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)

at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)

at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)

at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)

at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)

at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)

at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)

at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)

at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)

at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)

at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)

at java.lang.Thread.run(Thread.java:534)
   发表时间:2004-03-12  
没有人有这方面的经验?我用的microsoft地jdbc.拜托,必胜客一顿。可以带mm。
0 请登录后投票
   发表时间:2004-03-14  
关注,我也碰到这个问题,不过是用clob的时候碰到,出错信息也是这样
0 请登录后投票
   发表时间:2004-03-15  
我们出现过这个错误后来改了其它的一个驱动,名字叫jtds-0.6.jar,然后一下数据源配置就可以了
0 请登录后投票
   发表时间:2004-03-15  
这个问题主要是驱动的问题
0 请登录后投票
   发表时间:2004-03-15  
谢谢。我排错中找到microsoft的jdbc不支持getBlob()方法。可是我用getBytes[]改写hibernate,反而得到更多的问题。晕。
  错误是:
Can't start a cloned connection while in manual transaction mode.

  改回来,也没有改变。我疯掉了。



   正在试验你说的驱动,通过地话,必胜客一定请。请留下的你的qq.
0 请登录后投票
   发表时间:2004-03-15  
修改驱动,问题解决。但是发现那个jbuilderx实在难用,改个jar。我是又重编译。又重启。还是不行。彻底铲除,他还是顽固使用ms地。快疯掉时,自己又好了。

那个提示驱动问题的同志请留下联系方法。一起吃饭交流一下经验。非常谢谢。
0 请登录后投票
论坛首页 Java企业应用版

跳转论坛:
Global site tag (gtag.js) - Google Analytics