On using SQL 4.21

Ok, I know it’s been all retro SQL server but bear with me… MSDE/SqlExpress is just too small for some pet project, and I want to run my SQL natively… So it’s 4.21 for now.

Anyways, I thought I’d mention that to run SQL 4.21 on Windows 7, you’ll need the userenv.dll from a Vista computer, just copy it to where your i386 files are so you can run the setup, even if it complains about your x64 dll as ‘The image file c:\sql\i386\userenv.dll is valid but is for a machine type other then the current machine…’. Let it continue and it’ll still run. Also remember to set it to 256 colors in the compatibility tab or you’ll never get to use any radio boxes… It still barfs initializing the services, but it’ll let you run the server, and slap down a working master database from a blank installed machine (say from NT 4.0..) Naturally you’ll have to comment out the line in setup.inf about the client access DLL dbnmpntw.dll, and register c:\sql\binn;c:\sql\dll yourself in the system’s path environment variable…

Oh and since I’m using such an ancient engine, one thing that is kind of annoying is that .net 3.5 only wants to talk to SQL Server 7.0 and higher. However using ODBC you can force it to talk to the ancient 4.21a

Here is what I’m using in my c# to talk to the sql server:

string myConnString = “Driver={SQL Server};Server=.;Database=datamine;Uid=sa;Pwd=”;
OdbcConnection myConnection = new OdbcConnection(myConnString);
OdbcCommand myCommand = new OdbcCommand(query, myConnection);
myConnection.Open();
OdbcDataReader myReader = myCommand.ExecuteReader();
myReader.Close();
myConnection.Close();

So with a little tweak you can get it running on Windows 7, and have .net talking to the database.

Another note is be sure to run the sqladmin tool, and hit the ‘system’ button, then under the manage menu, select the system configuration. By default it won’t accept remote connections, and limits itself to 6MB of ram! You’ll want to bump up its system limits. I’d also say use tempdb in ram, as you probably have more ram in your computer then any server back from 1992… I have 8GB for example on my desktop.

Just don’t forget that something this ancient won’t grow your databases for you… I’m pretty sure you can add additional database devices, and expand the DB, but it will be a while until I fill my first DB… Also you’ll probably find that a lot of the fancy SQL features you’ve grown to like are gone, but surprisingly it still offers a good base. And it’s like 25Mb for the complete install… A pittance by modern standards…

3 thoughts on “On using SQL 4.21

  1. Well using Windows 10, it doesn’t matter anymore as ODBC doesn’t support any of the old Sybase SQL stuff anymore.

    Unhandled Exception: System.Data.Odbc.OdbcException: ERROR [08002] [Microsoft][ODBC SQL Server Driver]SQL Server version 6.5 and all previous versions are no longer supported

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.