Why connecting to an OLEDB is giving me an connection error

爱⌒轻易说出口 提交于 2019-12-06 00:34:37

After much troubleshooting, I was able to figure out why it wasn't working. I rewrote the string like this:

string cString = "Provider=sqloledb;Data Source=myserver;Initial Catalog=mydatabase;User Id=myid;Password=mypassword;";

That worked like a charm, in case someone else is having the same issue.

Don't use "Integrated Security" when you are supplying the user ID and password.

Using this video mentioned by Borat in the comments I was able to reference differences in the connection string to adjust mine. The video demonstrates windows authentication, so if that's not what you want be sure to add your own user id and password.

My issue was my provider attribute was referencing: "Provider=IBMDASQL.DataSource.1" when connection to DB/2 but the connection string when viewed as shown in the video was referencing, "IBMDA400.DataSource.1"

Funny, after watching the video, I already knew this, and have used this method but have forgotten. How quickly we forget things.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!