Hi I am trying connect to DB2 but it is giving an error as
[UDB Source [1]] Error: IBM.Data.DB2.DB2Exception: ERROR [58031] [IBM] SQL1031N The database directory cannot be found on the indicated file system. SQLSTATE=58031
It is an SSIS package where I am using a script component to connect to DB2.but it is not openning the connection.
My piece of code is
string dbName = "GRTST";
string uid = "c001";
string pwd = "winter1";
DB2Connection conn = new DB2Connection();
conn.ConnectionString = "DataBase=" + dbName + ";" + "Uid=" + uid + ";" +"Pwd="+ pwd + ";";
conn.Open();
The error description is
[UDB Source [1]] Error: IBM.Data.DB2.DB2Exception: ERROR [58031] [IBM] SQL1031N The database directory cannot be found on the indicated file system. SQLSTATE=58031
at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.HandleUserException(Exception e) at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.PrimeOutput(Int32 outputs, Int32[] outputIDs, PipelineBuffer[] buffers) at Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostPrimeOutput(IDTSManagedComponentWrapper100 wrapper, Int32 outputs, Int32[] outputIDs, IDTSBuffer100[] buffers, IntPtr ppBufferWirePacket)
Please provide me your valuable suggestion so that I can move forward.
The issue in the question is that you have not specified the server to which you would like to connect in the connection string. Following link shows how to formulate a DB2 connection string:
Connection strings for IBM DB2
Having said that, what you are trying to do in the question is not an appropriate way to connect to a database. You should create a data source at the SSIS project level or a connection manager within the SSIS package to connect to your DB2 data source. Following links describe how to connect to a DB2 data source using Microsoft OLE DB Provider for DB2
.
Connecting to DB2 from SSIS - Another link
Also, here is the MSDN documentation on how to add connection managers
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.