[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.odbcnet

Sybase ODBC connection problems in dotnet

Zack

7/16/2002 8:00:00 PM

Hi,

I've created an ODBC connection using the Sybase System 11
driver. Within dotnet, I'm able to create an
SqlConnection object using this ODBC connection. Clicking
on the "Test Connection" button also succeeds. However,
once I try to add an SqlCommand, I receive the following
error: "Server does not exist or access denied."

I receive the same error when I create the connection
string programatically and then attempt to open it.

Any suggestions?

Thanks,
Zack
7 Answers

(Douglas Laudenschlager [MS])

7/16/2002 9:43:00 PM

0


Zack,

You should be using the separately-downloaded ODBC Data Provider in order
to connect to Sybase through the Sybase ODBC Driver. Your project would
have a reference to the Microsoft.Data.Odbc namespace, and you would be
using an ODBCConnection object, not a SQLConnection object. The ODBC Data
Provider is available at
http://msdn.microsoft.com/downloads/default.asp?url=/downloads/sam...
l=/MSDN-FILES/027/001/668/msdncompositedoc.xml&frame=true.

If you are using the ODBC Data Provider and your connection is still
failing, will you please post your connection string?

-Doug



This posting is provided "AS IS" with no warranties, and confers no rights.

Are you secure? For information about the Microsoft Strategic Technology
Protection Program and to order your FREE Security Tool Kit, please visit
http://www.microsoft.co....

Mahesh Subramanian

7/18/2002 3:59:00 AM

0

Zack Try running this code, it works for me

public int connect()
{
string connectstring;
cn = new OdbcConnection();
connectstring = "Provider=MSDASQL;Integrate
Security=SSPI;Persist Security Infoúlse;"+
"DRIVER={Sybase System 11};UID="
+ uid + ";PWD=" + pwd +";database="+dbname +";srvr=" +
srvrname ;

cn.ConnectionString = connectstring;
cn.Open();

MessageBox.Show("Connection String " +
GetBaseConnectionString());

return 0;

}




>-----Original Message-----
>Hi,
>
>I've created an ODBC connection using the Sybase System
11
>driver. Within dotnet, I'm able to create an
>SqlConnection object using this ODBC connection.
Clicking
>on the "Test Connection" button also succeeds. However,
>once I try to add an SqlCommand, I receive the following
>error: "Server does not exist or access denied."
>
>I receive the same error when I create the connection
>string programatically and then attempt to open it.
>
>Any suggestions?
>
>Thanks,
>Zack
>.
>

Joseph Jagrup

7/18/2002 2:34:00 PM

0

Mahesh,
You wouldn't happen to have a code snippet in connecting Sybase to a
Datagrid in an aspx page in Language="VBScript" ???


Thanks in advance
-Joseph-


"Mahesh Subramanian" <mmsubramanian@rapidigm.com> wrote in message
news:196f801c22dfe$d203e950$9ae62ecf@tkmsftngxa02...
> Zack Try running this code, it works for me
>
> public int connect()
> {
> string connectstring;
> cn = new OdbcConnection();
> connectstring = "Provider=MSDASQL;Integrate
> Security=SSPI;Persist Security Info=False;"+
> "DRIVER={Sybase System 11};UID="
> + uid + ";PWD=" + pwd +";database="+dbname +";srvr=" +
> srvrname ;
>
> cn.ConnectionString = connectstring;
> cn.Open();
>
> MessageBox.Show("Connection String " +
> GetBaseConnectionString());
>
> return 0;
>
> }
>
>
>
>
> >-----Original Message-----
> >Hi,
> >
> >I've created an ODBC connection using the Sybase System
> 11
> >driver. Within dotnet, I'm able to create an
> >SqlConnection object using this ODBC connection.
> Clicking
> >on the "Test Connection" button also succeeds. However,
> >once I try to add an SqlCommand, I receive the following
> >error: "Server does not exist or access denied."
> >
> >I receive the same error when I create the connection
> >string programatically and then attempt to open it.
> >
> >Any suggestions?
> >
> >Thanks,
> >Zack
> >.
> >


Mahesh Subramanian

7/18/2002 8:52:00 PM

0

Joseph,
I am currently doing a app that uses DataGrid and Sybase
but that code is in C#.

Mahesh

>-----Original Message-----
>Mahesh,
>You wouldn't happen to have a code snippet in connecting
Sybase to a
>Datagrid in an aspx page in Language="VBScript" ???
>
>
>Thanks in advance
>-Joseph-
>
>
>"Mahesh Subramanian" <mmsubramanian@rapidigm.com> wrote
in message
>news:196f801c22dfe$d203e950$9ae62ecf@tkmsftngxa02...
>> Zack Try running this code, it works for me
>>
>> public int connect()
>> {
>> string connectstring;
>> cn = new OdbcConnection();
>> connectstring = "Provider=MSDASQL;Integrate
>> Security=SSPI;Persist Security Infoúlse;"+
>> "DRIVER={Sybase System 11};UID="
>> + uid + ";PWD=" + pwd +";database="+dbname +";srvr=" +
>> srvrname ;
>>
>> cn.ConnectionString = connectstring;
>> cn.Open();
>>
>> MessageBox.Show("Connection String " +
>> GetBaseConnectionString());
>>
>> return 0;
>>
>> }
>>
>>
>>
>>
>> >-----Original Message-----
>> >Hi,
>> >
>> >I've created an ODBC connection using the Sybase System
>> 11
>> >driver. Within dotnet, I'm able to create an
>> >SqlConnection object using this ODBC connection.
>> Clicking
>> >on the "Test Connection" button also succeeds.
However,
>> >once I try to add an SqlCommand, I receive the
following
>> >error: "Server does not exist or access denied."
>> >
>> >I receive the same error when I create the connection
>> >string programatically and then attempt to open it.
>> >
>> >Any suggestions?
>> >
>> >Thanks,
>> >Zack
>> >.
>> >
>
>
>.
>

Zack

7/18/2002 10:22:00 PM

0

Thanks for your help Mahesh. Here are the additional
steps I had to perform, since I hadn't loaded the odbc dll
yet:

1. Download the following dll and reference in app:
Microsoft.Data.Odbc.dll

2. Add the following namespace: using Microsoft.Data.Odbc;

If anyone's interested my code ended up looking like this
for binding to a grid (this is done in ASP.NET):

string connectstring = "Driver{Sybase System
11};srvr=myserver;UID=myuserid;PWD=mypassword;Database=mydb
;";
OdbcDataAdapter da = new
OdbcDataAdapter(thisSqlString, connectstring);
DataSet ds = new DataSet();
da.Fill(ds);
DataGrid1.DataSource = ds;
DataGrid1.DataBind();

(The OdbcConnection() also worked.)

Thanks for your assistance. I wasn't sure if this would
work since Sybase isn't explicity mentioned by MS, but it
does.

Thanks,
Zack

>-----Original Message-----
>Zack Try running this code, it works for me
>
>public int connect()
> {
> string connectstring;
> cn = new OdbcConnection();
> connectstring = "Provider=MSDASQL;Integrate
>Security=SSPI;Persist Security Infoúlse;"+
> "DRIVER={Sybase System 11};UID="
>+ uid + ";PWD=" + pwd +";database="+dbname +";srvr=" +
>srvrname ;
>
> cn.ConnectionString = connectstring;
> cn.Open();
>
> MessageBox.Show("Connection String " +
>GetBaseConnectionString());
>
> return 0;
>
> }
>
>
>
>
>>-----Original Message-----
>>Hi,
>>
>>I've created an ODBC connection using the Sybase System
>11
>>driver. Within dotnet, I'm able to create an
>>SqlConnection object using this ODBC connection.
>Clicking
>>on the "Test Connection" button also succeeds. However,
>>once I try to add an SqlCommand, I receive the following
>>error: "Server does not exist or access denied."
>>
>>I receive the same error when I create the connection
>>string programatically and then attempt to open it.
>>
>>Any suggestions?
>>
>>Thanks,
>>Zack
>>.
>>
>.
>

Joseph Jagrup

7/19/2002 2:00:00 PM

0

Mahesh,
I finally got it using a DSN, it's at ...
http://www.asp.net/Forums/ShowPost.aspx?tabindex=1&Po...

Thanks again,
-Joseph-

"Mahesh Subramanian" <mmsubramanian@rapidigm.com> wrote in message
news:1a58601c22e8c$517582b0$3bef2ecf@TKMSFTNGXA10...
> Joseph,
> I am currently doing a app that uses DataGrid and Sybase
> but that code is in C#.
>
> Mahesh
>
> >-----Original Message-----
> >Mahesh,
> >You wouldn't happen to have a code snippet in connecting
> Sybase to a
> >Datagrid in an aspx page in Language="VBScript" ???
> >
> >
> >Thanks in advance
> >-Joseph-
> >
> >
> >"Mahesh Subramanian" <mmsubramanian@rapidigm.com> wrote
> in message
> >news:196f801c22dfe$d203e950$9ae62ecf@tkmsftngxa02...
> >> Zack Try running this code, it works for me
> >>
> >> public int connect()
> >> {
> >> string connectstring;
> >> cn = new OdbcConnection();
> >> connectstring = "Provider=MSDASQL;Integrate
> >> Security=SSPI;Persist Security Info=False;"+
> >> "DRIVER={Sybase System 11};UID="
> >> + uid + ";PWD=" + pwd +";database="+dbname +";srvr=" +
> >> srvrname ;
> >>
> >> cn.ConnectionString = connectstring;
> >> cn.Open();
> >>
> >> MessageBox.Show("Connection String " +
> >> GetBaseConnectionString());
> >>
> >> return 0;
> >>
> >> }
> >>
> >>
> >>
> >>
> >> >-----Original Message-----
> >> >Hi,
> >> >
> >> >I've created an ODBC connection using the Sybase System
> >> 11
> >> >driver. Within dotnet, I'm able to create an
> >> >SqlConnection object using this ODBC connection.
> >> Clicking
> >> >on the "Test Connection" button also succeeds.
> However,
> >> >once I try to add an SqlCommand, I receive the
> following
> >> >error: "Server does not exist or access denied."
> >> >
> >> >I receive the same error when I create the connection
> >> >string programatically and then attempt to open it.
> >> >
> >> >Any suggestions?
> >> >
> >> >Thanks,
> >> >Zack
> >> >.
> >> >
> >
> >
> >.
> >


Joseph Jagrup

7/19/2002 2:10:00 PM

0

Zack,
That's great you got it to work DSN_Less, I did an article for other Sybase
programmers for refference ...
http://www.asp.net/Forums/ShowPost.aspx?tabindex=1&Po...

-Joseph-


"Zack" <zack@ucsd.edu> wrote in message
news:19fcc01c22e98$d114c060$9be62ecf@tkmsftngxa03...
> Thanks for your help Mahesh. Here are the additional
> steps I had to perform, since I hadn't loaded the odbc dll
> yet:
>
> 1. Download the following dll and reference in app:
> Microsoft.Data.Odbc.dll
>
> 2. Add the following namespace: using Microsoft.Data.Odbc;
>
> If anyone's interested my code ended up looking like this
> for binding to a grid (this is done in ASP.NET):
>
> string connectstring = "Driver=
> {Sybase System
> 11};srvr=myserver;UID=myuserid;PWD=mypassword;Database=mydb
> ;";
> OdbcDataAdapter da = new
> OdbcDataAdapter(thisSqlString, connectstring);
> DataSet ds = new DataSet();
> da.Fill(ds);
> DataGrid1.DataSource = ds;
> DataGrid1.DataBind();
>
> (The OdbcConnection() also worked.)
>
> Thanks for your assistance. I wasn't sure if this would
> work since Sybase isn't explicity mentioned by MS, but it
> does.
>
> Thanks,
> Zack
>
> >-----Original Message-----
> >Zack Try running this code, it works for me
> >
> >public int connect()
> > {
> > string connectstring;
> > cn = new OdbcConnection();
> > connectstring = "Provider=MSDASQL;Integrate
> >Security=SSPI;Persist Security Info=False;"+
> > "DRIVER={Sybase System 11};UID="
> >+ uid + ";PWD=" + pwd +";database="+dbname +";srvr=" +
> >srvrname ;
> >
> > cn.ConnectionString = connectstring;
> > cn.Open();
> >
> > MessageBox.Show("Connection String " +
> >GetBaseConnectionString());
> >
> > return 0;
> >
> > }
> >
> >
> >
> >
> >>-----Original Message-----
> >>Hi,
> >>
> >>I've created an ODBC connection using the Sybase System
> >11
> >>driver. Within dotnet, I'm able to create an
> >>SqlConnection object using this ODBC connection.
> >Clicking
> >>on the "Test Connection" button also succeeds. However,
> >>once I try to add an SqlCommand, I receive the following
> >>error: "Server does not exist or access denied."
> >>
> >>I receive the same error when I create the connection
> >>string programatically and then attempt to open it.
> >>
> >>Any suggestions?
> >>
> >>Thanks,
> >>Zack
> >>.
> >>
> >.
> >