如何使用scriplet提高从oracle 10g到jsp页面的数据传输速度

发布于 2024-10-13 19:49:02 字数 2068 浏览 1 评论 0原文

我已经将我的 jsp 页面与自动建议功能合并在一起,并且为了使自动建议发挥作用,它必须使用 scriplet 创建要建议的数据数组。

我的问题是,当我从oracle 10G导入数据时,完成将数据导入页面的时间约为20-40秒。

因此,有什么方法可以提高数据传输的速度我已经尝试过索引方法,但它确实有助于节省时间,并且表中的数据数量约为 6K 。

oracle 专业人士可以建议任何方法来解决这个问题.. 呵呵 =D

这是我的程序示例:-

我的 autosuggest.java 中的函数,用于检索和过滤我的数据库中的数据。

    public List getVendorName() throws Exception
{
    List temp=null; 
    Database db=null;
    String tempVar, tempVar2;
    boolean tempVar3, tempVar4;
    int counter=0;
    try {
        db = PersistenceHelper.beginTransaction();
        JDOQuery queryFund = new JDOQuery(db,Trader.class);
        queryFund.setFilter(PersistenceHelper.getOrganizationFilter("organization"));
        temp = new ArrayList();
        QueryResults results = queryFund.execute();
        while(results.hasMore())
        {
            Trader trader   = (Trader) results.next();
            tempVar     = "\""+trader.getName()+"\"";
            tempVar2    = trader.getTraderType();
            tempVar3    = trader.getRegTraderStatus();
            tempVar4    = trader.getMainTraderStatus();
            if(!tempVar2.equalsIgnoreCase("c"))
            {
                if( (tempVar3 == true) && (tempVar4 == true))
                {
                    tempVar     = tempVar.replace("\n", "");
                    temp.add(counter,tempVar); counter++;               
                }
            }           
        }
    } 
    catch (Exception e) {
        System.out.println(e);
    }       
    finally{
        PersistenceHelper.closeTransaction(db, false);
    }
    return temp;
}

我的jsp页面中的函数。从 autosuggest.java 检索数据;

    function getVendorName()
{
    var temp = new Array();
    <%
        AutoSuggest as = new AutoSuggest();
        List tempList = as.getVendorName();
        for(int i=0; i<tempList.size(); i++)
        {
            Strinmg tempVar  = (String) tempList.get(i);
            %> temp[<%=i%>] = <%=tempVar%>; <%
        }
    %>
    return temp;
}

I have incorporated my jsp pages with an autosuggest features, and to make the autosuggest functioning, it has to make an array of the data to be suggested using scriplet.

My issues is, as i import the data from oracle 10G, the time to complete the import of the data into the pages, is about 20-40 second.

Hence, is there any way to increase the speed of data transfer i already try the indexing method but it does help with the time, and the number of data in the table is about 6K .

Can the oracle pro, suggest any ways to solve this issues.. hehe =D

And here is the sample of my program :-

Function in my autosuggest.java, to retrieve and filter the data from my db.

    public List getVendorName() throws Exception
{
    List temp=null; 
    Database db=null;
    String tempVar, tempVar2;
    boolean tempVar3, tempVar4;
    int counter=0;
    try {
        db = PersistenceHelper.beginTransaction();
        JDOQuery queryFund = new JDOQuery(db,Trader.class);
        queryFund.setFilter(PersistenceHelper.getOrganizationFilter("organization"));
        temp = new ArrayList();
        QueryResults results = queryFund.execute();
        while(results.hasMore())
        {
            Trader trader   = (Trader) results.next();
            tempVar     = "\""+trader.getName()+"\"";
            tempVar2    = trader.getTraderType();
            tempVar3    = trader.getRegTraderStatus();
            tempVar4    = trader.getMainTraderStatus();
            if(!tempVar2.equalsIgnoreCase("c"))
            {
                if( (tempVar3 == true) && (tempVar4 == true))
                {
                    tempVar     = tempVar.replace("\n", "");
                    temp.add(counter,tempVar); counter++;               
                }
            }           
        }
    } 
    catch (Exception e) {
        System.out.println(e);
    }       
    finally{
        PersistenceHelper.closeTransaction(db, false);
    }
    return temp;
}

Function in my jsp page. to retrieve the data from autosuggest.java;

    function getVendorName()
{
    var temp = new Array();
    <%
        AutoSuggest as = new AutoSuggest();
        List tempList = as.getVendorName();
        for(int i=0; i<tempList.size(); i++)
        {
            Strinmg tempVar  = (String) tempList.get(i);
            %> temp[<%=i%>] = <%=tempVar%>; <%
        }
    %>
    return temp;
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

空城缀染半城烟沙 2024-10-20 19:49:02

首先要尝试的是在数据库查询中按交易者类型和状态进行过滤……而不是在 Java 端。您当前执行此操作的方式将需要从数据库中提取大量 Trader 对象。我预计它们中的大多数都会被 Java 代码丢弃。

The first thing to try would be to do the filtering by trader type and status in the database query ... rather on the Java side. The way you are currently doing this will entail pulling large numbers of Trader objects from the database. I expect most of them are then being discarded by your Java code.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文