CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2009
    Posts
    1

    ODBC connection string trouble

    Hello.

    I am using Sybase SQL Anywhere 11 on the server side.

    The problem is I have a DSN with the ServerName and CommLinks set in it, and that's it.

    I have some code in my C# application where I connect to the server and default database, and all works fine.

    In my application I want to connect to another database running on the same server.

    My problem is that when I state the DatabaseName in the connection string, it seems to ignore it. It just

    connects to the default database.
    BUT! When I define the DatabaseName in the odbc.ini file, it connects to the right database running on the

    server and everything works as it should.

    The connection string it self looks like this (where the variables are input parameters):
    string connectionString = DSN=" +dsn +";UID=" +uid +";PWD=" +password +";DBN=" +dbn;

    And I only get connected to the default database, when I specify the other database which is running on the server as the DBN.

    Any pointers? I don't want to make a separate DSN for each of my databases, heh.

  2. #2
    Join Date
    Sep 2006
    Posts
    95

    Re: ODBC connection string trouble

    Take a look over here sybase-adaptive it lists a whole bunch of connection string possibilities for Sybase.
    I'm no expert on sybase myself, but from what I read, I think that you'll have to change the database manually after you have connected, or something similar.
    On Error Kill(User)

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured