Forum Discussion

Holly_Greger's avatar
Holly_Greger
Contributor
15 years ago

Adding 300+ properties to a DataSource=very poor performance

I’m trying to bring into a DataSource a few rows from a SQL Server, but am facing a huge performance issue when am trying to dynamically add 300+ properties that correspond to the column names of the rows.
I am dynamically adding the properties from a groovy script and when the script executes, it seems to add the first 100 properties without much problem but then it takes a long time to add the rest. My script is the following…

import groovy.sql.Sql

def db = [url:'jdbc:sqlserver://server:1433', user:'user', password:'pass', driver:'com.microsoft.sqlserver.jdbc.SQLServerDriver']
def sql = Sql.newInstance(db.url, db.user, db.password, db.driver)

//rowSet holds the names of all columns
def rowSet = sql.rows("select TOP 1 * from tableName where")[0].keySet() as Set;

rowSet.each{
testRunner.testCase.testSteps["DataSource"].addProperty(it)
log.info "Property \"${it}\" added..."
}

I believe bringing in rows from a DB and the automatic creation of properties that map to the column names should be a seamless process and as far as I know is presently not. Maybe am approaching it the wrong way?
  • Hi,

    this is strictly related to the table displayed in the datasource log, if you have the datasource window closed when running the script it should go much faster. Can you give that a try?

    regards!

    /Ole
    eviware.com