[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

microsoft.public.dotnet.framework.odbcnet

Open an odbc connection in a web sevice project

Sébastien

1/16/2003 11:21:00 AM

Hi,

I try to open a connection with Ms access using a DNS in the connection
string.

here is my webmethod:

<WebMethod(Description:="Open an ODBC connection with DSN")>

Public Function RetrieveCustomers() As String

Dim MyConnection As OdbcConnection

Dim MyAdapter As OdbcDataAdapter

Dim MyDataset As DataSet



Dim connectionstr As String

sqlstr = "SELECT * FROM T_Customer;"

connectionstr = "dsn=dbtest"

MyConnection = New OdbcConnection(connectionstr)

MyConnection.Open()

System.Windows.Forms.MessageBox.Show("ServerVersion: " +
MyConnection.ServerVersion _

+ ControlChars.Cr + "DataSource: " + MyConnection.DataSource.ToString())

MyConnection.Close()

End Function

When I debug my application, an error occurs while opening the connection
and says:

System.Web.Services.Protocols.SoapException: Server was unable to process
request. ---> Microsoft.Data.Odbc.OdbcException: ERROR [IM002]
[Microsoft][ODBC Driver Manager] Data source name not found and no default
driver specified at Microsoft.Data.Odbc.OdbcConnection.Open()

I suppose that the ODBC data source is well configured.

Any ideas??

thanks


Sébastien


1 Answer

K. Lilov

1/16/2003 8:56:00 PM

0

Sebastien,

Make sure the DSN is defined at the machine level, not user level. Web
services run under a different user account than your own, and this looks
like a security issue.

Hope this helps,
K. Lilov
Str Library at http://www.utilityco...

"Sébastien" <s.beaux@ifrance.com> wrote in message
news:OnYw2iUvCHA.2296@TK2MSFTNGP09...
> Hi,
>
> I try to open a connection with Ms access using a DNS in the connection
> string.
>
> here is my webmethod:
>
> <WebMethod(Description:="Open an ODBC connection with DSN")>
>
> Public Function RetrieveCustomers() As String
>
> Dim MyConnection As OdbcConnection
>
> Dim MyAdapter As OdbcDataAdapter
>
> Dim MyDataset As DataSet
>
>
>
> Dim connectionstr As String
>
> sqlstr = "SELECT * FROM T_Customer;"
>
> connectionstr = "dsn=dbtest"
>
> MyConnection = New OdbcConnection(connectionstr)
>
> MyConnection.Open()
>
> System.Windows.Forms.MessageBox.Show("ServerVersion: " +
> MyConnection.ServerVersion _
>
> + ControlChars.Cr + "DataSource: " + MyConnection.DataSource.ToString())
>
> MyConnection.Close()
>
> End Function
>
> When I debug my application, an error occurs while opening the connection
> and says:
>
> System.Web.Services.Protocols.SoapException: Server was unable to process
> request. ---> Microsoft.Data.Odbc.OdbcException: ERROR [IM002]
> [Microsoft][ODBC Driver Manager] Data source name not found and no default
> driver specified at Microsoft.Data.Odbc.OdbcConnection.Open()
>
> I suppose that the ODBC data source is well configured.
>
> Any ideas??
>
> thanks
>
>
> Sébastien
>
>