• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 198
  • Last Modified:

CGI Application to connect to SQL Server

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
Stuart_Johnson
Asked:
Stuart_Johnson
  • 4
  • 3
  • 2
1 Solution
 
Greg RowlandSoftware Designer, SysDBA, WebMaster OwnerCommented:
Listening.

This is something I have been planning to try, are you testing this locally or across the Internet?
0
 
Stuart_JohnsonAuthor Commented:
Locally and live.  

Stu
0
 
MotazCommented:
Why you are using Aliases, it is better to use ADO, I try it with many CGI applications and it works fine.

Motaz
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

 
Stuart_JohnsonAuthor Commented:
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
 
MotazCommented:
I'm using: Provider=SQLOLEDB.1;

make sure that Data Source (Moonterra) is accessible for the Apache user name.
0
 
MotazCommented:
Example of complete connection string:
  'Provider=SQLOLEDB.1;Password=' + MyPassword +
';Persist Security Info=True;User ID=' + UserNam +
    ';Initial Catalog=Test;Data Source=' + ServerName;
0
 
Stuart_JohnsonAuthor Commented:
Hi Motaz,

Thanks for that!  Worked perfectly!

Stu
0
 
Greg RowlandSoftware Designer, SysDBA, WebMaster OwnerCommented:
Listening.

This is something I have been planning to try, are you testing this locally or across the Internet?
0
 
Stuart_JohnsonAuthor Commented:
You already asked that :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

  • 4
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now