我在64位Windows 2008服务器上。在SSIS中,我有一个连接到ODBC连接的ADO.NET数据流项。预览工作正常。当我在DEBUG模式下执行时,抛出以下异常:
[ADO NET Source [53]] Error: System.Data.Odbc.OdbcException: ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
at System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle, RetCode retcode)
at System.Data.Odbc.OdbcConnectionHandle..ctor(OdbcConnection connection, OdbcConnectionString constr, OdbcEnvironmentHandle environmentHandle)
at System.Data.Odbc.OdbcConnectionOpen..ctor(OdbcConnection outerConnection, OdbcConnectionString connectionOptions)
at System.Data.Odbc.OdbcConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.Odbc.OdbcConnection.Open()
at Microsoft.SqlServer.Dts.Runtime.ManagedHelper.GetManagedConnection(String assemblyQualifiedName, String connStr, Object transaction)
at Microsoft.SqlServer.Dts.Runtime.Wrapper.IDTSConnectionManager100.AcquireConnection(Object pTransaction)
at Microsoft.SqlServer.Dts.Pipeline.DataReaderSourceAdapter.AcquireConnections(Object transaction)
at Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostAcquireConnections(IDTSManagedComponentWrapper100 wrapper, Object transaction)
我能找到的最好的是SSIS找不到数据源,因为它正在查找64位,这与32位不同。有没有办法覆盖此默认值以指向32位ODBC?
答案 0 :(得分:1)
通过在Project Debugging Options中将Run64BitRuntime设置为false来解决此问题。这会导致错误:
[ADO NET Source 1]错误:SSIS错误代码DTS_E_INDUCEDTRANSFORMFAILUREONERROR。 “组件”ADO NET源“(1)”失败,因为发生错误代码0x80131937,并且“输出列”Z_ID“(38)”上的错误行处置指定错误失败。指定组件的指定对象发生错误。在此之前可能会发布错误消息,其中包含有关失败的更多信息。
第三方ODBC驱动程序和.NET之间存在缺陷。按照以下步骤解决此问题: http://blogs.msdn.com/sqlblog/archive/2009/04/09/after-installation-of-net-framework-3-5-sp1-or-net-framework-2-0-sp2-ssis-packages-using-odbc-3rd-party-drivers-may-fail.aspx
答案 1 :(得分:1)
安装64位版本的mysql-connector-odbc-5.1.6-winx64.msi 32位客户端(XP / Vista 32位)使用ODBC 3.51 64位clinets(Vista 64位)使用ODBC 5.1
conn.ConnectionString = “DRIVER = {MySQL ODBC 5.1 Driver};” + “SERVER = nnn.nnn.nn.nnn;” + “DATABASE = my_sql_database;” + “UID = my_uid;” + “PASSWORD = my_pwd;”;
conn.ConnectionString =“DSN = my_odbc_dsn”;
答案 2 :(得分:0)
尝试重新创建DNS连接。
转到C:\ Windows \ SysWOW64并查找odbcad32并配置连接。
然后
转到C:\ Windows \ System32并查找odbcad32并再次配置连接。
同时使用相同的名称。