Results 1 to 3 of 3

Thread: DSN Problem w/ ASP.NET

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2003
    Location
    Chicago, IL
    Posts
    102

    DSN Problem w/ ASP.NET

    I am trying to connect to an IBM AS/400 Database. I have created a system DSN called "SR". I am using the following code:

    VB Code:
    1. Dim cnItemConn As New Odbc.OdbcConnection
    2. Dim daItemAdapter As New Odbc.OdbcDataAdapter
    3. Dim dsItemSet As New DataSet
    4. Dim cmdselect As New Odbc.OdbcCommand
    5. Dim sCmd As String
    6.  
    7. cnItemConn.ConnectionString = "DSN=SR;uid=xxxx;pwd=yyyyy;Driver={Client Access ODBC Driver (32-bit)}"
    8.  
    9. dsItemSet.Tables.Add("Items")
    10.  
    11. sCmd = "SELECT IASA.ITNBR, IBL.MOHTQ, IASA.WHSLC, IASA.ITDSC FROM AMFLIBX.ITEMBL AS IBL LEFT OUTER JOIN AMFLIBX.ITEMASA AS IASA ON IBL.ITNBR=IASA.ITNBR WHERE IASA.ITNBR ='90503'"
    12.  
    13. cmdselect.Connection = cnItemConn
    14. cmdselect.CommandText = sCmd
    15.  
    16. daItemAdapter.SelectCommand = cmdselect
    17.  
    18. daItemAdapter.Fill(dsItemSet.Tables("Items"))

    When I run this code in an ASP.NET Web App I get an error, "Data Source Name not found and no default driver specified." The exact same code in a VB.NET Windows application, running on the same PC hosting the Web App, works fine. Any ideas?
    Joe Cody
    Data Integration Engineer
    Novaspect, Inc.
    Elk Grove Village, IL

  2. #2
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267

    Re: DSN Problem w/ ASP.NET

    You should try to connect without the DSN if you can. Meaning use a fully Connection String based Connection. Also is there a DataSource configured on the Web Server? That's where it has to be for a Web Based app.

    I haven't worked with an AS/400 in 4 or 5 years and I had problems then because we didn't have the correct drivers on our server(Web Server). You also might want to look into the cause being related ASPNET user name and that ASP.Net Try to connect with this.

    Sorry I can't be more helpfull. Are you working with DB2?
    Magiaus

    If I helped give me some points.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Aug 2003
    Location
    Chicago, IL
    Posts
    102

    Re: DSN Problem w/ ASP.NET

    I tried both DSN and DSN-less connections to no avail. The desktop machine is the web server so permissions and drivers shouldn't be an issue. I managed to get the app working using OLE, but I would still like to resolve the ODBC issue for future reference...
    Joe Cody
    Data Integration Engineer
    Novaspect, Inc.
    Elk Grove Village, IL

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