Solved

CGI Application to connect to SQL Server

Posted on 2002-05-01
9
155 Views
Last Modified: 2010-04-04
Hi,

Can someone give me an example of connecting to an SQL Server through a CGI app?  I've built my basic application, but each time I try to connect to the database, I get this error: "Unknown database. Alias: MOONTERRA"

I'm using Apache on MS Windows 2000 Pro in CGI mode (not ISAPI).

Any help greatfully accepted :)

Cheers

Stu
0
Comment
Question by:Stuart_Johnson
  • 4
  • 3
  • 2
9 Comments
 
LVL 4

Expert Comment

by:SurferJoe
ID: 6984224
Listening.

This is something I have been planning to try, are you testing this locally or across the Internet?
0
 
LVL 6

Author Comment

by:Stuart_Johnson
ID: 6984648
Locally and live.  

Stu
0
 
LVL 7

Expert Comment

by:Motaz
ID: 6985304
Why you are using Aliases, it is better to use ADO, I try it with many CGI applications and it works fine.

Motaz
0
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 
LVL 6

Author Comment

by:Stuart_Johnson
ID: 6985457
When I try it with ADO I get the error:

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

My connection string clearly states it though.

Provider=MSDASQL.1;Persist Security Info=False;User ID=SA;Data Source=MOONTERRA

Any ideas?

Stu
0
 
LVL 7

Expert Comment

by:Motaz
ID: 6985570
I'm using: Provider=SQLOLEDB.1;

make sure that Data Source (Moonterra) is accessible for the Apache user name.
0
 
LVL 7

Accepted Solution

by:
Motaz earned 100 total points
ID: 6985575
Example of complete connection string:
  'Provider=SQLOLEDB.1;Password=' + MyPassword +
';Persist Security Info=True;User ID=' + UserNam +
    ';Initial Catalog=Test;Data Source=' + ServerName;
0
 
LVL 6

Author Comment

by:Stuart_Johnson
ID: 6985978
Hi Motaz,

Thanks for that!  Worked perfectly!

Stu
0
 
LVL 4

Expert Comment

by:SurferJoe
ID: 6986926
Listening.

This is something I have been planning to try, are you testing this locally or across the Internet?
0
 
LVL 6

Author Comment

by:Stuart_Johnson
ID: 6987503
You already asked that :)
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi component that can load a DLL in design time? 8 64
Working with hours 3 58
can't find the executable in Simulator 1 90
enhance the following code 3 32
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question