none
Connection String for ODBC vs. OLE DB RRS feed

  • Question

  • If I develop an app involving connection string, I typically go with ODBC connection string, because I can find the data source property when I go to Control Panel > System and Security > Administrative Tools > Data Source (ODBC) .

    I am not an IT guy, but I do programming while and while. I have never used OLE DB connection string before, if I go with OLE DB connection string, where should I look for the information in my computer? Take below connection string for example, where should I find the information? Should I also look into Data Source (ODBC) under Control Panel?

    Thanks.

    ----------------------------------------------------------

    Provider=Sybase.ASEOLEDBProvider;Srvr=myASEserver,5000;Catalog=myDataBase;

    User Id=myUsername;Password=myPassword;

    Tuesday, November 19, 2019 4:48 PM

Answers

  • Hi VA_er, 

    It is not appropriate to look for information about OLEDB connection string in ODBC Data Source Administrator. ODBC Data Source Administrator is related to data source in ODBC which is different from OLEDB.

    You can use visual studio tools (Tools -> connect to database…) to help you connect to database.

    For example:

    It will help you connect to database or find the connect string.

    You can refer to following reference for more details.

    Add new connections

    Hope it could be helpful.

    Best Regards,

    Xingyu Zhao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by VA_er Sunday, November 24, 2019 1:12 AM
    Friday, November 22, 2019 8:37 AM
    Moderator

All replies

  • All popular connection strings are found here, not the same as ODBC data sources.

    https://www.connectionstrings.com/


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Tuesday, November 19, 2019 5:37 PM
    Moderator
  • All popular connection strings are found here, not the same as ODBC data sources.

    https://www.connectionstrings.com/



    Your reply is irrelevant to my question. I know the website.

    Honestly, I appreciate your active role on this website. But quite often, I find your reply not useful. As thread author, I don't mind if there is irrelevant reply in my thread. But my goal is getting the right answer. I am writing this, because I believe if the thread has been answered, it reduces the chance of being answered by someone else. I know you try to help, but sometimes your help is not helpful. You have been involved in too many threads, I don't believe you have time to answer each thread seriously. Sometimes I post a thread asking a specific question, instead, you always reply with general information. It is like: I come across a specific question related building stair inside the house, in stead answering my question, you say "hey, forget about your house, here is how to build the whole house, which includes building the stair. Just push down the house, build the house in my way". Maybe I can build an alternative house like you suggest, but I may not like the house you suggest. More importantly, people learn by solving every little specific question. Everyone knows how to use google to search such kind of general information, not all questions are same, sometimes answering the thread by copying & pasting does not really address the question. 



    • Edited by VA_er Tuesday, November 19, 2019 6:25 PM
    Tuesday, November 19, 2019 5:49 PM
  • All popular connection strings are found here, not the same as ODBC data sources.

    https://www.connectionstrings.com/



    Your reply is irrelevant to my question. I know the website.

    Honestly, I appreciate your active role on this website. But quite often, I find your reply not useful. As thread author, I don't mind if there is irrelevant reply in my thread. But my goal is getting the right answer. I am writing this, because I believe if the thread has been answered, it reduces the chance of being answered by someone else. I know you try to help, but sometimes your help is not helpful. You have been involved in too many threads, I don't believe you have time to answer each thread seriously. Sometimes I post a thread asking a specific question, instead, you always reply with general information. It is like: I come across a specific question related building stair inside the house, in stead answering my question, you say "hey, forget about your house, here is how to build the whole house, which includes building the stair. Just push down the house, build the house in my way". Maybe I can build an alternative house like you suggest, but I may not like the house you suggest. More importantly, people learn by solving every little specific question. Everyone knows how to use google to search such kind of general information, not all questions are same, sometimes answering the thread by copying & pasting does not really address the question. 



    I will stop responding to your question now and in the future.

    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Tuesday, November 19, 2019 8:02 PM
    Moderator
  • Hi VA_er, 

    Thank you for posting here.

    According to your description, I have some questions to confirm with you.

    Could you provide your kind of the database that you want to connect to when using oledb connection string?

    Do you want to know oledb connection strings in different databases if database is not specified?

    Please provide more information and it will help us to analyze your problem and make a test.

    We are waiting for your update.

    Best Regards,

    Xingyu Zhao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, November 20, 2019 7:57 AM
    Moderator
  • Generally it is just quicker to use the URL that Karen provided to go get the format of the connection string needed by the provider you want. They often provide the variants that are hard to convey in documentation. 

    Yet another option is to use Visual Studio's Server Explorer and then add a new Data Connection. It limits you to the .NET providers but is equivalent to using the Data Sources option in Windows. Then you can copy the connection string via the properties window (F4) of the connection.

    Alternatively I used to use a little VB script that effectively uses Data Source's UI to get the underlying connection string.

    Dim objDataLinks, strRetVal
    Set objDataLinks = CreateObject("DataLinks")
    On Error Resume Next ' ignore cancel
    strRetVal = objDataLinks.PromptNew
    On Error Goto 0
    If Not IsEmpty(strRetVal) Then
    InputBox "Your Connection String is listed below.", _
             "OLE DB Connection String", strRetVal
    End If
    Set objDataLinks = Nothing

    I have no idea where I got this but I used to use it all the time.



    Michael Taylor http://www.michaeltaylorp3.net

    Wednesday, November 20, 2019 2:44 PM
    Moderator
  • Hi VA_er, 

    Thank you for posting here.

    According to your description, I have some questions to confirm with you.

    Could you provide your kind of the database that you want to connect to when using oledb connection string?

    Do you want to know oledb connection strings in different databases if database is not specified?

    Please provide more information and it will help us to analyze your problem and make a test.

    We are waiting for your update.

    Best Regards,

    Xingyu Zhao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

     See attached screenshot, so in general, if I use OLE DB connection string, I also need to look for database property from that screenshot? My whole question is: where to look for database property if I use OLE DC connection string?

    Thanks.

    Wednesday, November 20, 2019 10:21 PM
  • Hi VA_er,

    Thanks for your feedback.

    For your question, I note that your database is Sybase database, Sybase database is a third party product for which we don't provide help. If you have more question about Sybase database, I suggest you ask your quesiton in their forum for more help.

    Besides, here's a reference about Connection String Syntax in the .NET Framework.

    Connection String Syntax

    You can see OleDb Connection String in following reference.

    OleDbConnection.ConnectionString

    Hope them can help you.

    Best Regards,

    Xingyu Zhao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, November 21, 2019 10:15 AM
    Moderator
  • Thanks for your quick reply. 

    But it does not really matter, I have other database too, see screenshot. My question is: if I want to use OLE DB connection string for database, I can find the standard connection string online, but I will need to replace the information with my own database property, such as Server, Database, etc. Do I also look for the information under Control Panel > Administrative Tools > ODBC Data Source Administrator only?

    Thank you.

    Thursday, November 21, 2019 12:54 PM
  • Hi VA_er, 

    It is not appropriate to look for information about OLEDB connection string in ODBC Data Source Administrator. ODBC Data Source Administrator is related to data source in ODBC which is different from OLEDB.

    You can use visual studio tools (Tools -> connect to database…) to help you connect to database.

    For example:

    It will help you connect to database or find the connect string.

    You can refer to following reference for more details.

    Add new connections

    Hope it could be helpful.

    Best Regards,

    Xingyu Zhao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by VA_er Sunday, November 24, 2019 1:12 AM
    Friday, November 22, 2019 8:37 AM
    Moderator
  • So is there a way to hard code OLE DB connection string. Here is my case: I am not IT folk, but I will try to explain as clearly as I can. My workplace computers use virtual desktop (cloud desktop), basically, when user turns on the PC, then open browser with specific https link, from there, user logs onto virtual desktop. When user is on virtual desktop, then he/she can access database or access. Before logging to Virtual Desktop, let me call it local machine. From the below screenshot, you can see that nothing is installed on local machine (no Microsoft, no database). Most employees just use standard version of Virtual Desktop (come with database access, Microsoft Office, etc). For a few employees who need additional software (such as Visual Studio), the software will be installed in local machine. That being said, developer cannot use studio tools (Tools -> connect to database…), since it will cause error when building the solution (cannot compile). That is why I used ODBC connection string (define a variable = connection string), after building the solution in the local machine, then I move the exe file to Virtual desktop.

    In other words, if I have to hard code OLE DB connection string as a variable, where should I look for database property information in order to write OLE DB connection string?

    Thanks.


    Saturday, November 23, 2019 12:09 AM