Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/341.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Crystal报告Java SDK为每个表打开数据库连接_Java_Sdk_Crystal Reports - Fatal编程技术网

Crystal报告Java SDK为每个表打开数据库连接

Crystal报告Java SDK为每个表打开数据库连接,java,sdk,crystal-reports,Java,Sdk,Crystal Reports,我想在这里了解一下Java Crystal Report SDK的工作原理。我有一个脚本,可以从crystal报告生成pdf。问题是脚本似乎正在打开一组数据库连接,导致数据库服务器崩溃。我相信脚本正在为报表中的每个表打开一个数据库连接 Tables tables = clientDoc.getDatabaseController().getDatabase().getTables(); for(int i = 0;i < tables.size();i++)

我想在这里了解一下Java Crystal Report SDK的工作原理。我有一个脚本,可以从crystal报告生成pdf。问题是脚本似乎正在打开一组数据库连接,导致数据库服务器崩溃。我相信脚本正在为报表中的每个表打开一个数据库连接

        Tables tables = clientDoc.getDatabaseController().getDatabase().getTables();
        for(int i = 0;i < tables.size();i++)
        {
            origTable = tables.getTable(i);
            newTable = (ITable)origTable.clone(true);
            newTable.setQualifiedName(origTable.getName());
            // Change connection information properties
            connectionInfo = newTable.getConnectionInfo();
            // Set new table connection property attributes
            propertyBag = new PropertyBag();

            // Overwrite any existing properties with updated values
            propertyBag.put("Trusted_Connection"  , TRUSTED_CONNECTION  );
            propertyBag.put("Server Type"         , SERVER_TYPE         );
            propertyBag.put("Use JDBC"            , USE_JDBC            );
            propertyBag.put("Database DLL"        , DATABASE_DLL        );
            propertyBag.put("JNDI Datasource Name", JNDI_DATASOURCE_NAME);
            propertyBag.put("Connection URL"      , CONNECTION_URL      );
            propertyBag.put("Database Class Name" , DATABASE_CLASS_NAME );
            connectionInfo.setAttributes(propertyBag);

            // Set database username and password
            // NOTE: Even if the username and password properties do not change
            // when switching databases, the
            // database password is *not* saved in the report and must be set at
            // runtime if the database is secured.
            connectionInfo.setUserName(DB_USER_NAME);
            connectionInfo.setPassword(DB_PASSWORD);

            // Update the table information
            clientDoc.getDatabaseController().setTableLocation(origTable, newTable);
        }
Tables Tables=clientDoc.getDatabaseController().getDatabase().getTables();
对于(int i=0;i
是否有一种方法可以使它在我运行脚本时(如果我的理解正确的话)只打开1个数据库连接,并对每个表使用相同的连接。是回购协议,我从中得到了我的大部分逻辑,以防你需要更多的背景