我在做JAVA SWING程序的时候,每当我查询一条语句的时候,我在SQL Profiler里面监视到有很多exec sp_cursorfetch 180150002, 16, **, 1语句运行,有多少条记录他就会生成这个东东多少条,严重影响了我的程序性能.我在网上查了很多相关资料,都好像没有一个明确的解决方法.不知你们有没有遇到类似问题.
   我现在想要达到的目的是不让它在SQL Profiler里面出现这个exec sp_cursorfetch******** 有人说<<"将连接字符串的SelectMethod修改为SelectMethod=cursor或删除该属性可以将游标改为客户端游标。">>改为客户端游标???但是JAVA好像不能改哦,也不知道在哪里改的.高手一旦解决问题,另外再加100分送上.

解决方案 »

  1.   

    jdbc:microsoft:sqlserver://192.168.1.13:1433;DatabaseName=WIND;SelectMethod=cursor
      

  2.   

    SQL Profiler会影响性能吗?
    有可能SQL Profiler影响性能,那你把SQL Profiler窗口关闭好了。
    我觉得是这样的道理,不知道有没有懂楼主的意思
      

  3.   

    在你的数据库连接字符串中添加"SelectMethod=cursor"不行么?
      

  4.   

    感谢二楼的代码,但是经测试还是不行.可能这个SelectMethod=cursor对于JAVA来说无效....
      

  5.   


    晕倒,SQL Profiler当然不会影响性能,只是在做开发的时候要用到的一个工具而矣.软件做完后当然不会再用.
      

  6.   


    我就是要客户端调用的简单查询语句.但是查询出来有很多条记录,所以才会导致在服务器的SQL探测器上面有很多条类似exec sp_cursorfetch******** 的记录.
      

  7.   

    提供一种思路吧,我们老师讲过的.
    把记录放在一个函数里面.
    用SQL批量完成数据的插入.
    再在oracle里定义一个包,在包里定义游标的类型.
    用到函数的时候,在通过包.函数来调用.
    这样灵活性强多了.
    本人不善表达,不晓得LZ看懂了我的意思没有?
      

  8.   

    不会影响性能的p6spy是通过套接字传输的,SQL Profiler是另一个jvm了。几乎没影响有影响也不是SQL Profiler,且影响忽略不计。
      

  9.   

    把你的调用代码贴出来,是jdbc还是其他orm,放出来看看,最近快没分用了,把你的问题搞定了,又够花一段时间了呵呵。
      

  10.   


    SQL Profiler是另一个jvm了????????????????
    你没弄明白吧?知道SQL Profiler是做什么用的不?
    其实这个就是一个简单的JAVA调用查询视图的代码.只是通过ResultSet来得到记录集.在SQL Profiler中应该就是一条select ...... 语句才对,但是多了那么多东东.有点郁闷
      

  11.   

    你说的不是这个吗
    Jahia.org has released SQL Profiler a new open source project based on P6Spy. SQL Profiler is a tool geared to help production users understand the hotspots in their system and identify candidates for indexing. SQL Profiler includes integrated parsing technology to explicitly identify tables and columns likely to need indexing and even generates a create script to create those indexes.
    利用p6spy利用log4j通过socket输出监视的sql
    你的SQL Profiler难到是和程序一起启动的??
    http://www.p6spy.com/index.htmlhttp://www.jahia.net/jahia/page597.html
    SQL Profiler Introduction 
    This is a quickly hacked tool to do statistics on SELECT queries in order to know where it is most efficient to create indexes.This small tool, released under an Apache-based license connects to the P6Spy JDBC logger and displays in real time the queries going to the database. It uses an integrated SQL parser to build statistics on the most accessed tables and columns and can generate SQL index creation files. Other information is also gathered and displayed, such as the request time for a single request, for a class of request, and for all the requests. Sorting may be done on these views to detect database problems efficiently.This tool can be very useful when you have a big volume of queries that you need to analyze not one by one (meaning that the specific time isn't that much of interest), but rather when you want to know what "group" of queries is taking a lot of time, such as queries on the same tables and columns but with different query values. The integrated SQL parser (built with ANTLR) is used to analyze the incoming SELECT queries.The Swing GUI was based on Apache's Log4J Chainsaw, but all the bugs are mine. Also contributors are welcome to test, make new suggestions, give their opinion and submit patches.
      

  12.   

    我用的SQL Profiler是MSSQL安装后就可用用的,不是第三方软件.不过我已经解决问题了.呵呵....