Click to See Complete Forum and Search --> : Error on remote server SQL query accessing multiple databases


ftj
May 12th, 2005, 09:26 AM
I have a single SQL query in my ASP.NET application that accesses 2 different databases. I open the two connections and send the command over one of them.

Dim OleDbCommand1 = New OleDbCommand
Dim dtrAsset As OleDbDataReader

OleDbCommand1.Connection = OleDbConnection1

OleDbCommand1.CommandText = "SELECT fund_basic.fundname, price.price * share_basic.bookshares " & _
"FROM ftjweb!share_basic " & _
"INNER JOIN global!price ON substr(share_basic.basicfund,3,5) = price.ticker " & _
"INNER JOIN ftjweb!fund_basic ON price.ticker = fund_basic.symbol " & _
"INNER JOIN ftjweb!allocation ON price.ticker = allocation.ticker AND share_basic.basicacct = allocation.clientacct AND share_basic.basicsubacct = allocation.clientsuba " & _
"WHERE share_basic.basicacct = ? AND share_basic.basicsubacct = ? AND share_basic.basicfund <> 'DFSCASH' " & _
"AND share_basic.bookshares <> 0.0000 "


OleDbCommand1.Parameters.Add("@basicacct", account)
OleDbCommand1.Parameters.Add("@basicsubacct", subaccnt)


OleDbConnectGraph.Open()

OleDbConnection1.Open()

dtrAsset = OleDbCommand1.ExecuteReader()

dtrAsset.Close()
OleDbConnectGraph.Close()
OleDbConnection1.Close()


My connection strings are correct. This code WORKS FINE on my pc but on the server I get the following error:

Server Error in '/Charts' Application.
--------------------------------------------------------------------------------

Cannot open file c:\winnt\system32\global.dbc.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException: Cannot open file c:\winnt\system32\global.dbc.

--------------------------------------------------------------------------------
I dont understand why its looking for global.dbc in c:\winnt\system32 when it is located in the inetpub directory on the server as specified in the connection string.

Appreciate any help!
Thanks

mmetzger
May 12th, 2005, 10:43 AM
The ASP.NET app more than likely cannot access the \winnt\system32 directory (ie, does not have permission.) Try putting your connection strings in web.config (or one of the other methods available) then see if this works properly.

ftj
May 16th, 2005, 08:51 AM
Thanks for your response. I have admin rights, so I have all the required permissions. Still doesn't work. Please help!

mmetzger
May 16th, 2005, 09:57 AM
That's what I mean. *You* may have admin rights, but the ASP.NET application likely does not. Depending on what OS you're using, you have to provide access for the ASP.NET account (ASP.NET, NETWORK SERVICE, etc.) to view that data.

ftj
May 17th, 2005, 10:07 AM
The ASPNET account has all the rights. Also the database in not located in the winnt directory (please refer to my first posting). Is it possible to have two different database connections open and run the SQL command over one connection with the command also accessing the other database connection? This works on my pc (Windows 2000) but not on Windows 2000 Advanced Server.