Showing posts with label alone. Show all posts
Showing posts with label alone. Show all posts

Sunday, February 19, 2012

C# and SQL 2005

a SQL2005 which is alone and A web server is under domain. I am using C#, it can open the connection, but it prompted error on talbe not found when excute the sql.

is the SQL2005 must join in same domain even use the SQL authorization?

No, definitely not. Using the right connection string to connect to the right database should work. Get your connection string at www.connectionstrings.com. Perhpas you are not connected to the right instance of your SQL Server ?

HTH, Jens suessmeyer,

http://www.sqlserver2005.de

|||

I have a Database named "SmartEngine060503BGCA"

I can use the Query Analyzer with SA to use the "SmartEngine060503BGCA"

I don't why I cannot use it in C#

I found that it only able to use the table in Master Database, e.g. sysfiles

//String dsn="Server=bgca-mosaic;Database=SmartEngine060503BGCA;User ID=sa;Password=sa;Trusted_Connection=False";
String dsn = "Data Source=bgca-mosaic;User Id=sa;Password=sa;Initial Catalog=SmartEngine060503BGCA";
SqlConnection sConn = new SqlConnection(dsn);
sConn.Open();
string ssql = "select * from mosaic";
SqlCommand sc = sConn.CreateCommand();
sc.CommandText = ssql;
SqlDataReader sr = sc.ExecuteReader();
sConn.Close();

--ERROR-

[SqlException (0x80131904): Invalid object name 'mosaic'.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +786210
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +684822
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +207
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1751
System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +37
System.Data.SqlClient.SqlDataReader.get_MetaData() +58
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +213
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +570
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +134
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +32
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +122
System.Data.SqlClient.SqlCommand.ExecuteReader() +84

|||Who is owner of "mosaic" table? Is it dbo or some other user?|||

Remember that the prefix is a schema in SQL Server 2005, not a user. What he means is try to figure about the Schema where the table is stored, the default one for the sa is dbo, if its not dbo, you have to prefix it before the objectname like SchemaName.ObjectName.

The information for that can be queried from the (SELECT * FROM) INFORMATION_SCHEMA.Tables View.

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de
-

Thursday, February 16, 2012

buying a new server to put SQL2000 onto

Our SQL Developer asked for a new server with a separate small hard disk for the Transaction Log alone to reside on, to increase performance. This will be hard to do, since the servers we have been looking at are low-profile rackmount, and only hold 2 SATA disks. I hate to waste our only expansion bay on a small HD. Is this really something important, or will a Quad-core processor and plenty of RAM make the performance difference negligible? We have 32-bit SQL2000 licensed per processor, and our database is only about 26GB. I was hoping to get 1 large disk and partition it into a 20GB OS partition, and the rest would be for SQL. Am I totally on the wrong track?

My 2nd question is about RAM - if we get 4GB of RAM, will it decrease the performance if we get 64-bit O/S pre-installed instead of 32-bit? I know 64-bit O/S *can use* more RAM than 4GB, but does it *need* more RAM for the same level of performance that we have now? (We are planning to expand that to at least 8-12GB whenever we upgrade to 64-bit SQL2005, but the budget does not allow it just yet.)

Thanks!


Ideally, there would be separate disk arrays for the Transaction Log, the database file, and the TempDb database. Notice, I mentioned disk arrays (Or LUNs on a SAN or NAS). Now that is for a high performance, high activity enterprise critical system. You needs may not be so critical.


You didn't mention if this server was for Development work, or for Production. (Development work can get by with considerably less server capability.)


I would choose the 64bit OS, it will use memory more efficiently and will allow for easier upgrade of your SQL Server. I would 'fast track' the SQL Server upgrade to 64 bit, and additional memory. And then a SAN or NAS, or disk array.


So for now, you 'may' be able to 'live' with the two SATA disks -put the TLog files on one, and the TempDb and Datafiles on the other. Don't expect a lot of performance improvement if your current situation is 'disk bound' -you may get some improvement, just don't expect it and hopefully you will be pleasantly surprised.

|||

Thanks, here are a few more details if it helps. This is a production server, but its for a small business and high availability is not that critical. (We have time to restore from tape if needed.) According to our Developer, we are processor-bound right now, we're maxing out an older single 32-bit 3GHz Xeon. We are currently running everything on one disk and currently running with 3GB of RAM. And we're not hurting all that bad for SQL performance, we are rearranging our hardware to allow for an Exchange Server upgrade, and we're planning to move SQL to a new machine because we think it would benefit from it more than Exchange would.

Thanks again for your advice