Working with SQL Server on NetHost

Acessing the Database

There are two convenient ways to access and manipulate your database on NetHostís SQL Server.

Using MS Access

MS Access 2000 is built to work with SQL Server. To access your database, create a new database project in Access:

File->New

At the dialog box that appears select Project (Existing Database) as in the picture below.

 

You will be required to create a file. The fileís suffix is adp.

After the file has been created the following dialog box appears:

 

Use the picture above as an example. Use the user and password that has been assigned to you.

 

In case you are working with a slow Internet connection, we recommend that you also choose Advanced and set the Connect Timeout to 60 seconds.

 

Now you have an ADP file that can be used to access and manipulate your database from anywhere on the Internet. Your user and password are stored in this file. The file size is small since the file does not contain any database data. It only contain information how to access the data that is stored on the SQL Server. Add tables, queries and forms just as you would do with a regular MS Access database. The tables will be created on the SQL Server.

Using SQL Server Enterprise Manager

For full control of your database, you can use SQL Server Enterprise Manager. This program comes with SQL Server installation (you can install only the Client Tools to get this program). To access your database with this manager, register NetHostís SQL Server with the program.

 

Choose:

Action->New SQL Server Registration to activate the registration Wizard. The following example of screen shots can help you. Use the user and password that has been assigned to you.

 

Eventually, your SQL Server Enterprise Manager will look something like this:

Openning Connections to the Database from ASP Files

Here is an example of how to open a connection to the SQL Server database.

set db = Server.CreateObject ("ADODB.Connection")

str ="Driver={SQLServer};server=sql.nethost.co.il;DATABASE=your_database;"

db.ConnectionString=str

db.Open

 

Note that there is no need to specify user and password. There are trust relationships between the web server and the SQL Server computer. The default is that connections that are created using the above method can read and write to the database. If you require a different setting, contact us.

You can add the user and password to the connection string in order to get full permissions for the database from your ASP code. In this case the connection string will be something like this:

str = "Driver={SQL Server};server=sql.nethost.co.il;DATABASE=demo;UID=user;PWD=password;"

This method has the disadvantage that if someone is able to view your code she can use this information to access your database.