Search code examples
snowflake-cloud-data-platformazure-data-factory

Unable to copy to SnowFlake Database with Azure Data Factory


I have setup the ADF Link Service and Staging area to copy to SnowFlake Datawarehouse with Azure Data Factory. However, the actual copy activity returns the following error:

ErrorCode=UserErrorOdbcOperationFailed,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=ERROR [22000] Cannot perform CREATE STAGE. This session does not have a current database. Call 'USE DATABASE', or use a qualified name.,Source=Microsoft.DataTransfer.Runtime.GenericOdbcConnectors,''Type=System.Data.Odbc.OdbcException,Message=ERROR [22000] Cannot perform CREATE STAGE. This session does not have a current database. Call 'USE DATABASE', or use a qualified name.,Source=SnowflakeODBC_sb64.dll,'

The Sink settings are as followings

enter image description here

The dataset properties are as follows:

enter image description here

Any thoughts?


Solution

  • Cannot perform CREATE STAGE. This session does not have a current database. Call 'USE DATABASE' or use a qualified name.

    This error often indicates that the database name is incorrect, that the database has not yet been established, or that the user does not have access to the database.

    To resolve this, follow below steps:

    • Make sure while creating linked service you are connected to the correct database and the user you are using to login in it have appropriate permissions.
    • You can use pre-copy script in snowflake connector to use that particular database with use databasename query. enter image description here

    And it is working fine for me: enter image description here