Connection to Sybase

Hi, I'm having problems creating a connection string to connect to a Sybase db.

I have tried both of these methods...

ODBC:
CONN_STRING = "driver=Adaptive Server Anywhere 9.0;server=XXX;Database=XXX;uid=xxx;pwd=xxx"
Dim xConn As New odbcConnection(CONN_STRING)
xConn.Open()

and the error I get is "ERROR [08001] [Sybase][ODBC Driver][Adaptive Server Anywhere]Database server not found"


OLEDB
CONN_STRING = "driver=Adaptive Server Anywhere 9.0;server=XXX;Database=XXX;uid=xxx;pwd=xxx"
Dim xConn As New oledbConnection(CONN_STRING)
xConn.Open()

error=No error message available, result code: E_FAIL(0x80004005).

Q1. Should I be using Oledb or odbc
Q2. What is wrong with my connection strings

I have a dns to conect to the db, which works fine.  If I set CONN_STRING = "Dsn=Manpack_Client" (using an odbcconnection) it works fine, so I can obvously connect to to db ok, but I don't want to do this as I have no control over the dsn on the machine, and if it changes, my app won't work

thanks, Adrian





Answer this question

Connection to Sybase

  • paul_portugal

    looks like I have no choice but to use a ODBC datasource, thanks for your help Paul

  • BlueJay07

    Thanks Vikram

    Actually, what I was looking for was a solution which didn't involve creating an
    ODBC Data Source, as the application is then dependant on it's existence.  For increased robustness, I'd prefer to use a connection string in code.

    Any ideas anyone

    p.s. I'm using vs2005 beta2

  • Chien-hao Wesley Wen

    Hello Anarchy,

    Did you get your problem solved i am sure you did, please help me by show me step by step, because i am band new with Visual Studio .NET 2005.

    thanks in advanced.


  • gimo

    First i would say thank you very much for your help, i waited for long time to find this.

    i am just a beginner of visual studio .net 2005, if i have other question, and need your help, can i send to you

    for me i think that you are my master.

    thank again.


  • d_clare

    Hi,

    You should first create a ODBC Data Source. Here are the steps:

     Vikram wrote:

    Step By Step:
    --------------
    1. Goto Control Panel->Administrative Tools
    2. Click Data Sources (ODBC).
    3. In the System DSN tab, Click Add button.
    4. ODBC driver for Sybase will appear in the drivers list.
    5. Create an ODBC data source following the wizard.
    6. Create an ODBCConnection object in VS.NET project and connect to the
    ODBC data source you have just created.

    Then use the ODBC provider in .net. Here's a guide:

    http://support.microsoft.com/default.aspx scid=kb;EN-US;q310985

     

    cheers,

    Paul June A. Domag



  • Gary Nicol

    Hi,

    I think its proper to post your question here in the forums. So that other beginners that have the same problem as yours could easily get the answer here.




    cheers,

    Paul June A. Domag


  • Malagant

    Hi,

    In the days of the ADO-VB6 I am using udl's to determine a certain conection string. To do this, try creating a .udl file (name it anything you like) upon opening the udl file, a wizard (more likely a configuration tool) would be shown, there you can visually choose your driver and connect to your database. After connecting, close the wizard and open it with notepad. There you would see the generated connection string. Use it in a OleDbConnection class...

     

     

    cheers,

    Paul June A. Domag



  • Connection to Sybase