How can a predefined query, which is stored in the database document, be executed? /* get the service manager */ xContext = UNO.connect() XMcf = xContext~getServiceManager /* retrieve the DatabaseContext and get its XNameAccess interface */ xNameAccess = xMcf~createInstanceWithContext(- "{%see com.sun.star.sdb.DatabaseContext}", xContext)~{%see com.sun.star.container.XNameAccess%XNameAccess} /* we use the "mysql-test" datasource */ dataSource = xNameAccess~getByName("mysql-test") /************ non-interactive login ************/ /* query for the XDataSource interface of the data source */ xDataSource = dataSource~{%see com.sun.star.sdbc.XDataSource%XDataSource} /* simple way to connect - hard code (usr,pw) */ xConnection = xDataSource~getConnection("stefan","apple"); /* execute a query definition */ xCommandPreparation = xConnection~{%see com.sun.star.sdb.XCommandPreparation%XCommandPreparation} xPreparedStatement = xCommandPreparation~prepareCommand(- "Query_names+products",- bsf.getStaticValue("{%see com.sun.star.sdb.CommandType}", "QUERY")) xResultSet = xPreparedStatement~executeQuery /* process the ResultSet */ xRow = xResultSet~{%see com.sun.star.sdbc.XRow%XRow} DO WHILE xResultSet~next <> .false firstname = xRow~getString(1) lastname = xRow~getString(2) product = xRow~getString(3) say firstname "|" lastname "|" product END ::requires UNO.cls -- get UNO support