Solved

CGI Application to connect to SQL Server

Posted on 2002-05-01
9
149 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
Comment Utility
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
Comment Utility
Locally and live.  

Stu
0
 
LVL 7

Expert Comment

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

Motaz
0
 
LVL 6

Author Comment

by:Stuart_Johnson
Comment Utility
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 7

Expert Comment

by:Motaz
Comment Utility
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
Comment Utility
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
Comment Utility
Hi Motaz,

Thanks for that!  Worked perfectly!

Stu
0
 
LVL 4

Expert Comment

by:SurferJoe
Comment Utility
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
Comment Utility
You already asked that :)
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

763 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now