Failure Fetching from Remote DB

Posts   
 
    
DaveR
User
Posts: 43
Joined: 15-Jun-2004
# Posted on: 24-Nov-2005 18:02:13   

We recently set up a SQL Server 2000 database on a remote server. We can connect to it with no problems using Query Analyzer and Enterprise Manager. However, LLBLGen SelfServicing objects fail to load.

It seems that LLBLGen can connect to the database and execute queries, but the query does not return results. For example:

try
{
  e = new AccountEntity(1);
}
catch (Exception ex)
{
  Debug.Write(exc.Message);
}
if (e.IsNew)
  Debug.Write("Failed to load.");

This code executes without throwing an exception. Tracing into the LLBLGen code, the SqlConnection object is correct,as is the query. However, after the query runs, AccountEntityBase.EntityState.Fetched is false.

There is in fact a record in the database with PK=1, which can be verified by running a manual query.

What are the possible causes of this?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 24-Nov-2005 18:48:13   

Is your connection string in your llblgen pro app pointing to the right server?

Frans Bouma | Lead developer LLBLGen Pro
DaveR
User
Posts: 43
Joined: 15-Jun-2004
# Posted on: 24-Nov-2005 19:47:31   

Yes, the connection string is correct. We set it using DbUtils.ActualConnectionString.

I tested using a bogus connection string, and as expected, it throws an exception.

So it seems as if LLBLGen can connect to the database, but for some reason, the query fails.

DaveR
User
Posts: 43
Joined: 15-Jun-2004
# Posted on: 24-Nov-2005 21:10:58   

I think I found the problem.

The tables in the remote database are owned by a different user than "dbo". In fact, the same tables exist with the "dbo" owner but all these tables are empty (due to permissions issue).

I see that I can use schema name overwriting to rename 'dbo' using the .config file. I would prefer a way to do it using code, but I assume it is not possible...?