invalid object sql error. maybe security??

M

mpriem

I am developing a C# windows application which will act as an frontend
for a SQL 2000 database.
I am using a laptop with SQl 2000 workgroup edition (sp4). SQL is setup
to use windows authentication.
When I use my application on my laptop everything works.
When I use my application on a SQL server (SQL 2000 enterprise sp4) in
my organisation I get the error : "invalid object <tablename>"

The database is a database generated by logman.exe and filled with
performance/capacity figures. The database structure is always the
same.
I am using the following code for the connection:
======================================================================
public static SqlConnection GetConnection(string a, string b,string
c)
{
string strConn;
if(c.Length !=0)
{
strConn = c;
}
else
{
strConn = "Data Source=" + a +";Initial Catalog=" + b +
";Integrated Security=SSPI;";
/* string strConn = "Integrated Security=SSPI;Initial Catalog = " +
c +
";Data Source=" + a + ";";*/
}
System.Windows.Forms.MessageBox.Show(strConn);
SqlConnection objConnection = null;
try
{
objConnection = new SqlConnection(strConn);
objConnection.Open();
}
catch(Exception ex)
{
objConnection = null;
System.Windows.Forms.MessageBox.Show("Fout bij verbinden : " +
ex.Message,"Connection fout");
}
finally
{
if (objConnection != null)
{
objConnection.Close();
}
}
return objConnection;
}
=======================================================================


The select statement I use is = SELECT MachineName FROM CounterDetails
GROUP BY MachineName

My ConnectionString is = "Data Source=" + a +";Initial Catalog=" + b +
";Integrated Security=SSPI;" (a = servername) (b = databasename);

My domainaccount has the dbowner role on the database. And
serverconnection goes ok!
The only strange thing I see in the eventlog is that my authentication
to the corporate SQL server is performed by NTLM. Why not by kerberos??
When I use a access frontend I always see Kerberos events in the
eventlog. Could this be a security issue? Or am I using the wrong
query?

code for query:
=======================================================================
public static DataSet ExecuteQuery(SqlConnection objConnection,
SqlDataAdapter objAdapter, string strQuery)
{
objConnection.Open();
System.Windows.Forms.MessageBox.Show(strQuery);
objAdapter.SelectCommand = new SqlCommand(strQuery,objConnection);
DataSet objDataSet = new DataSet();
try
{
objAdapter.Fill(objDataSet,"x");
objConnection.Close();
}
catch(Exception ex)
{
System.Windows.Forms.MessageBox.Show("SQL: " + ex.Message,"SQL
fout");
}
finally
{
if (objConnection != null)
{
objConnection.Close();
}
}
return objDataSet;
objDataSet.Dispose();
}
}
=======================================================================
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

That's probably cause the user that created the object is different from the
one trying to use it now:
1- Go to enterprise manager , your DB, tables and see who is the owner of
the table
2- access the table using [db_user].tablename


Cheers,
 
M

mpriem

thanks, I will try that.
Another question:

When I use my access frontend I can see Kerberos events in the SQL
server eventlog.
When I use my c# frontend it is NTLM..
I cannot see the code behind the Access frontend because its a mde.

On my production workstation I am part of a w2k3 domain as is my sql
server. Why doesn't SSPI use the Kerberos provider??
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top