Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

CGI Application to connect to SQL Server

Posted on 2002-05-01
9
156 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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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: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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Send message from delphi to whatsapp, is it possible? 3 1,667
FMX enumerated colours 2 115
code issue 8 154
Show Listview image from database (String field) 5 135
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

860 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