Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

CGI Application to connect to SQL Server

Posted on 2002-05-01
9
Medium Priority
?
181 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:Greg Rowland
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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 400 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:Greg Rowland
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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

926 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