+ Reply to Thread
Results 1 to 23 of 23

Sybase Connection: Data source name not found and no default driver specified

  1. #1
    Forum Contributor
    Join Date
    09-10-2016
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    680

    Sybase Connection: Data source name not found and no default driver specified

    Error Message.jpg

    Error message: see the screenshot.

    Please Login or Register  to view this content.
    I have try to put whole drive path H:\syb-15_0\DataAccess\ODBC\dll\ABCDE.dll inside {}, and it did not work either.

    I also found database/srvr information when running Regedit.
    http://www.erlandsendata.no/english/...adacconnstring


    One more thing: In VBA developer window, there is Reference under the menu Tools, and I am not sure if I need to choose something. I did not find Sybase listed there.

    Thanks.

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,887

    Re: Sybase Connection: Data source name not found and no default driver specified

    First, you need to change provider from default ADODB to Sybase provider.

    Depends on your Sybase... assuming Sybase Adaptive Server
    Provider should be... (this replaces Driver parameter)
    Please Login or Register  to view this content.
    You may also need to set Port (Default I believe is 5000) after srvr.

    I'd recommend studying connection string in link below.
    https://www.connectionstrings.com/sybase-adaptive/

    Also, read up on Sybase specific documentation (Search for terms like "ODBC Connection String" etc).
    http://infocenter.sybase.com/help/in...x/CHDEIBCB.htm

  3. #3
    Forum Contributor
    Join Date
    09-10-2016
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    680

    Re: Sybase Connection: Data source name not found and no default driver specified

    Quote Originally Posted by CK76 View Post
    First, you need to change provider from default ADODB to Sybase provider.
    ...
    Thanks for help. This is the first time for me to use VBA to deal with database(not quite understand the code, just search/copy/replace some codes), Username/Password are userform textbox input value.

    It seems my database coming with the port beginning 20, total 5 digits. But still getting the same error message. Port 5000 does not work either.

    Please Login or Register  to view this content.
    Port.jpg
    Last edited by VAer; 01-11-2017 at 03:44 PM.

  4. #4
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,887

    Re: Sybase Connection: Data source name not found and no default driver specified

    I don't have Sybase Server that I can test (haven't dealt with one in at least few years).
    But code below is one way to connect and open recordset.

    Please Login or Register  to view this content.
    Note that as it is indicated in link provided in my previous post.
    You may need to specify charset in ".ConnectionString".

    Few other things to check/try:
    1. Make sure you have correct ODBC driver installed and using correct one (ex. 64Bit installed but trying to use 32Bit..)
    http://stackoverflow.com/questions/2...annot-be-found
    2. Try replacing "Data Source=ServerName" & "Port=Port#" with "Data Source=\\myserver\myvolume\mypat\mydd.add"
    3. Depending on your Sybase driver you'd need different connection string. Hence need to check Sybase documentation.
    http://www.erlandsendata.no/english/...adacconnstring

  5. #5
    Forum Contributor
    Join Date
    09-10-2016
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    680

    Re: Sybase Connection: Data source name not found and no default driver specified

    Quote Originally Posted by CK76 View Post
    I don't have Sybase Server that I can test (haven't dealt with one in at least few years).
    But code below is one way to connect and open recordset.
    First, I really thank for your time.

    What does CursorLocation mean? I have not gone that far yet, at this point, I only want the program to test username/password. All I want to know is if I can access the database, if I only perform one single task, then I can add the task in this portion of code. But, there are multiple tasks, I can choose what to do, no need to do all the tasks.

    Code structure: If username/password is correct, then switch to another userform, which has multiple buttons. For example, the other userform has button A (pulling data from table X), button B (pulling data from table Y), button C (loading record to table X), ..... Right now, username/password userform is more like a website login page, if user log in, he/she may do whatever he/she wants to do.

    I would follow something like below link. If username/password is correct, then return a message "Username/password is correct"; if it is wrong, return error message "Invalid username/password".

    https://www.experts-exchange.com/que...do-in-vba.html

  6. #6
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,887

    Re: Sybase Connection: Data source name not found and no default driver specified

    CursorLocation is basically used to set how recordset is accessed/navigated.

    3 = adUseClient, recordset is brought to the client at once, and leaves all navigating operation to the client. Adds less overhead to server side. But with large recordsets, this is slower than serverside.
    This also means recordset is accessible as read-only (recordset updates to the host are not possible)
    2 = adUseServer, navigation is handled by the server. Client communicate to server how to navigate and server does it. On large recordset, this is faster, but adds more overhead to the server.

    When using adUseServer, you can also set CursorType... such as:
    adOpenStatic - does not allow any updates, inserts or deletions.
    adOpenForwardOnly - almost same as above, but you can only scroll forward through records. Improves performance if you need to make only one pass through a recordset.
    adOpenDynamic - All type of movement through the recordset is allowed. And additions, changes, deletions by other users are visible.
    adOpenKeyset - As adOpenDynamic, but can't see records that other users add. Records deleted by other users are inaccessible from your recordset (data changes are visible).

    You'll probably want to read through link if you are not familiar with ADO/ADODB programming.
    https://msdn.microsoft.com/en-us/lib...(v=vs.85).aspx

  7. #7
    Forum Contributor
    Join Date
    09-10-2016
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    680

    Re: Sybase Connection: Data source name not found and no default driver specified

    Quote Originally Posted by CK76 View Post
    I don't have Sybase Server th
    It still does not work.

    Run-time error 3706 "Provider cannot be found.It may not be installed properly."

  8. #8
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,887

    Re: Sybase Connection: Data source name not found and no default driver specified

    Do you know your ODBC provider & driver version for Sybase that you are using?

    Without knowing that, can't really help you any further.

  9. #9
    Forum Contributor
    Join Date
    09-10-2016
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    680

    Re: Sybase Connection: Data source name not found and no default driver specified

    Quote Originally Posted by CK76 View Post
    Do you know your ODBC provider & driver version for Sybase that you are using?
    I am not an IT person, where to find such information, here is another screenshot. Earlier screenshot is for "General" tab, and this screenshot is for "About" tab, they are from same window.

    Thanks.

    Sybase.jpg

  10. #10
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,887

    Re: Sybase Connection: Data source name not found and no default driver specified

    Since you are using Sybase ASE 15 instead of the connection string sample I provided. You need something like below.

    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    09-10-2016
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    680

    Re: Sybase Connection: Data source name not found and no default driver specified

    Quote Originally Posted by CK76 View Post
    Since you are using Sybase ASE 15 instead of the connection string sample I provided. You need something like below.

    Please Login or Register  to view this content.
    How about cn.open part? The code cannot compile without cn.open

    Please Login or Register  to view this content.
    Now it goes back to first error: Data source name not found and no default driver specified.

    In screenshot, what is the difference between source name and server name?

    Thanks.

  12. #12
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,887

    Re: Sybase Connection: Data source name not found and no default driver specified

    Server Name/Address will depend on your set up. And also check with whomever that set it up that it's open to external connection.

    With DNS set up, server name is often used, but it may require IP address of the server.

    I really do recommend that yo scour the Sybase documentation I gave you and verify info with your IT.

  13. #13
    Forum Contributor
    Join Date
    09-10-2016
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    680

    Re: Sybase Connection: Data source name not found and no default driver specified

    Quote Originally Posted by CK76 View Post
    Server Name.
    Thanks for your help, I think I will do a little research. I would not reply on IT department, if they are helpful, I would not have asked questions. First, I am sure they are not very knowledgeable, they simply maintains some software, they don't actually program a lot. When we need something technique, we spend money and asking IT contractor company to develop. Second, their mission simply does not cover this kind of job, if I need keyboard, if my computer does not work, then I can call IT department. But if I don't know how to do my job, that is not the reason to ask for information.

    Not sure if I need this statement Set cn = CreateObject("ADODB.Connection"), since it is ODBC in my computer (remote desktop). Or do I need some kind of reference (Tool> Dropdown check boxes)
    Last edited by VAer; 01-19-2017 at 06:20 PM.

  14. #14
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,887

    Re: Sybase Connection: Data source name not found and no default driver specified

    You need to set object. As each new connection instance is a separate object. It's done via late binding.
    For ADO connection and recordset is separate object and treated as such.
    For details, go through the link provided in post #6 of this thread.

    If you want to use reference and use early binding method, reference "Microsoft ActiveX Data Objects x.x Library" in your project.

  15. #15
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,887

    Re: Sybase Connection: Data source name not found and no default driver specified

    I would not reply on IT department, if they are helpful, I would not have asked questions.
    Ok so it may not be IT, but who maintains this Sybase server and DB? Surely someone is administering it. That's the person you should speak to (their title can be IT, DB admin, etc).

  16. #16
    Valued Forum Contributor
    Join Date
    02-06-2014
    Location
    N/A
    MS-Off Ver
    N/A
    Posts
    373

    Re: Sybase Connection: Data source name not found and no default driver specified

    This may or may not be helpful, but I've run into similar situations with database drivers, and I've found it easier to just add a linked table in MS Access then ADO to Access.

    Please Login or Register  to view this content.

  17. #17
    Valued Forum Contributor
    Join Date
    02-06-2014
    Location
    N/A
    MS-Off Ver
    N/A
    Posts
    373

    Re: Sybase Connection: Data source name not found and no default driver specified

    Also, have you added an instance of the database driver to ODBC manager?

    C:\Windows\System32\odbcad32.exe

    OR

    C:\Windows\SysWOW64\odbcad32.exe

  18. #18
    Valued Forum Contributor
    Join Date
    02-06-2014
    Location
    N/A
    MS-Off Ver
    N/A
    Posts
    373

    Re: Sybase Connection: Data source name not found and no default driver specified

    duplicate post

  19. #19
    Forum Contributor
    Join Date
    09-10-2016
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    680

    Re: Sybase Connection: Data source name not found and no default driver specified

    Quote Originally Posted by CK76 View Post
    Ok so it may not be.
    It is maintained by IT department. It should not be IP issue, since SAS program can connect and pull data from the same database.
    Last edited by VAer; 01-19-2017 at 08:17 PM.

  20. #20
    Forum Contributor
    Join Date
    09-10-2016
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    680

    Re: Sybase Connection: Data source name not found and no default driver specified

    Quote Originally Posted by Poizhan View Post
    Also, have you added an instance of the database driver to ODBC manager?

    C:\Windows\System32\odbcad32.exe

    OR

    C:\Windows\SysWOW64\odbcad32.exe
    Yes............

  21. #21
    Forum Contributor
    Join Date
    09-10-2016
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    680

    Re: Sybase Connection: Data source name not found and no default driver specified

    Duplicate.....
    Last edited by VAer; 01-19-2017 at 09:10 PM.

  22. #22
    Forum Contributor
    Join Date
    09-10-2016
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    680

    Re: Sybase Connection: Data source name not found and no default driver specified

    http://wiki.servicenow.com/index.php....png#gsc.tab=0

    Do I need some setting here first? I think this is what VBA code supposed to do. Thanks.

  23. #23
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,887

    Re: Sybase Connection: Data source name not found and no default driver specified

    No. ADO is separate from MS Query.
    Though both makes use of ODBC driver.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. VBA Sybase Connection
    By VAer in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-10-2017, 07:08 PM
  2. Replies: 3
    Last Post: 10-18-2016, 03:51 AM
  3. Pivot table - break connection to data source
    By TheRobsterUK in forum Excel General
    Replies: 8
    Last Post: 04-09-2014, 07:21 AM
  4. Replies: 2
    Last Post: 10-08-2013, 10:42 AM
  5. Replies: 3
    Last Post: 06-14-2012, 02:57 PM
  6. Extracting of data from a website using VBA or XML or data source connection
    By joelhuang in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-19-2010, 09:57 PM
  7. Replies: 2
    Last Post: 12-10-2007, 07:43 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1