Toad World® Forums

Local Storage Automation Export Error

When I run an automation task using the “test” button it runs correctly, however, when I run the task via a batch file it will not run. The automation fails saying that the there is “no database selected”. Another process before this imports the data into the local storage without issue and all other “non local storage” exports work fine. Is this a bug or do I need to adjust some settings?

– 10/25/2011 12:07:20 PM: AveragesExport.log: Setting up environment
– 10/25/2011 12:07:20 PM: AveragesExport.log: Script run by Toad for Data Analysts 3.0.0.1694
– 10/25/2011 12:07:20 PM: AveragesExport.log: Build started
– 10/25/2011 12:07:20 PM: AveragesExport.log: Compiling Script
– 10/25/2011 12:07:22 PM: AveragesExport.log: Warning: No Exception Handler. To send an Email when there is an error, change the value of Email on Error to true and enter email values.
– 10/25/2011 12:07:22 PM: AveragesExport.log: Build Completed
– 10/25/2011 12:07:22 PM: AveragesExport.log: Begin execution script activities
– 10/25/2011 12:07:23 PM: AveragesExport.log: Connecting to Local Storage Connection
– 10/25/2011 12:07:25 PM: AveragesExport.log: Connection To: Local Storage Connection
– 10/25/2011 12:07:25 PM: AveragesExport.log: Connection successful
– 10/25/2011 12:07:25 PM: AveragesExport.log: Connection logon: root
– 10/25/2011 12:07:25 PM: AveragesExport.log: Last schema:
– 10/25/2011 12:07:25 PM: AveragesExport.log: Default schema:
– 10/25/2011 12:07:25 PM: AveragesExport.log: Auto Commit: True
– 10/25/2011 12:07:26 PM: AveragesExport.log: Connection successful.
– 10/25/2011 12:07:26 PM: AveragesExport.log: Excuting export using connection in template
– 10/25/2011 12:07:26 PM: AveragesExport.log: Beginning export: <Quest.Toad.ImportExport.ExportEngine></Quest.Toad.ImportExport.ExportEngine>
– 10/25/2011 12:07:27 PM: AveragesExport.log: 12:07:26 PM Thread (8) Adding Export Notification Subscriber {0}
– 10/25/2011 12:07:27 PM: AveragesExport.log: 12:07:26 PM Thread (8) Export Started [10/25/2011 12:07:26 PM]
– 10/25/2011 12:07:27 PM: AveragesExport.log: 12:07:26 PM Thread (8) ** START **
– 10/25/2011 12:07:28 PM: AveragesExport.log: 12:07:26 PM Thread (8) Export using connection: root@localhost
– 10/25/2011 12:07:28 PM: AveragesExport.log: 12:07:26 PM Thread (8) Export Wizard: Building object list
– 10/25/2011 12:07:28 PM: AveragesExport.log: 12:07:26 PM Thread (8) Build List done.
– 10/25/2011 12:07:28 PM: AveragesExport.log: 12:07:26 PM Thread (8) Exporting Data (1 of 1)
– 10/25/2011 12:07:28 PM: AveragesExport.log: 12:07:26 PM Thread (8) BEGIN Query :
– 10/25/2011 12:07:28 PM: AveragesExport.log: 12:07:26 PM Thread (8) Object SQL Query started.
– 10/25/2011 12:07:29 PM: AveragesExport.log: 12:07:26 PM Thread (6) InternalReadBackground - start
– 10/25/2011 12:07:29 PM: AveragesExport.log: 12:07:26 PM Thread (6) InternalReadBackground - exception No database selected
– 10/25/2011 12:07:29 PM: AveragesExport.log: 12:07:26 PM Thread (6) InternalReadBackground - stack at MySql.Data.MySqlClient.MySqlStream.ReadPacket()
– 10/25/2011 12:07:29 PM: AveragesExport.log: at MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int32& insertedId)
– 10/25/2011 12:07:29 PM: AveragesExport.log: at MySql.Data.MySqlClient.Driver.GetResult(Int32 statementId, Int32& affectedRows, Int32& insertedId)
– 10/25/2011 12:07:29 PM: AveragesExport.log: at MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId, Boolean force)
– 10/25/2011 12:07:30 PM: AveragesExport.log: at MySql.Data.MySqlClient.MySqlDataReader.NextResult()
– 10/25/2011 12:07:30 PM: AveragesExport.log: at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
– 10/25/2011 12:07:30 PM: AveragesExport.log: at MySql.Data.MySqlClient.MySqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
– 10/25/2011 12:07:30 PM: AveragesExport.log: at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
– 10/25/2011 12:07:30 PM: AveragesExport.log: at Quest.Toad.Db.ToadDataAdapter.InternalReadBackground()
– 10/25/2011 12:07:30 PM: AveragesExport.log: 12:07:27 PM Thread (12) DoneReadTreadWriter
– 10/25/2011 12:07:31 PM: AveragesExport.log: 12:07:27 PM Thread (12) DoneReadThreadWriter finally - adapter.RowsRead 0
– 10/25/2011 12:07:31 PM: AveragesExport.log: 12:07:27 PM Thread (8) END Query :
– 10/25/2011 12:07:31 PM: AveragesExport.log: 12:07:27 PM Thread (8) Object SQL Query finished with error: No database selected
– 10/25/2011 12:07:31 PM: AveragesExport.log: 12:07:27 PM Thread (8) at MySql.Data.MySqlClient.MySqlStream.ReadPacket()
– 10/25/2011 12:07:32 PM: AveragesExport.log: at MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int32& insertedId)
– 10/25/2011 12:07:32 PM: AveragesExport.log: at MySql.Data.MySqlClient.Driver.GetResult(Int32 statementId, Int32& affectedRows, Int32& insertedId)
– 10/25/2011 12:07:32 PM: AveragesExport.log: at MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId, Boolean force)
– 10/25/2011 12:07:32 PM: AveragesExport.log: at MySql.Data.MySqlClient.MySqlDataReader.NextResult()
– 10/25/2011 12:07:32 PM: AveragesExport.log: at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
– 10/25/2011 12:07:32 PM: AveragesExport.log: at MySql.Data.MySqlClient.MySqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
– 10/25/2011 12:07:33 PM: AveragesExport.log: at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
– 10/25/2011 12:07:33 PM: AveragesExport.log: at Quest.Toad.Db.ToadDataAdapter.InternalReadBackground()
– 10/25/2011 12:07:33 PM: AveragesExport.log: 12:07:27 PM Thread (8) Export Finished [10/25/2011 12:07:27 PM]
– 10/25/2011 12:07:33 PM: AveragesExport.log: Thread (8) Build Time 00:00:00.0660000
– 10/25/2011 12:07:33 PM: AveragesExport.log: Thread (8) Complete Time 00:00:00.5380000
– 10/25/2011 12:07:33 PM: AveragesExport.log: 12:07:27 PM Thread (8) ** END **
– 10/25/2011 12:07:34 PM: AveragesExport.log: Successfully exported 0 rows.
– 10/25/2011 12:07:34 PM: AveragesExport.log: Export Finished, click AveragesNew.xlsx to view file.
– 10/25/2011 12:07:34 PM: AveragesExport.log: Export_1 - No database selected

– 10/25/2011 12:07:34 PM: AveragesExport.log: Failed

Nevermind, by adding the database name before the table name in the sub query fixed the problem. I am not sure why this wasn’t an issue when running the .tas file manually but problem solved.

When you are running the application the editor and Object Explorer alter the session to point to the database you are using. When running a scheduled script the UI is not used so that alter session doesn’t get done. It is always best to fully qualify your SQL for automation scripts.

Debbie