CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.

YesSoftware Forums -> CodeCharge Studio -> PHP

 (RESOLVED) CCS PHP/Apache not connecting to SQL Server 2008

Print topic Send  topic

Author Message

Posts: 8
Posted: 04/05/2011, 9:38 AM

I am trying to use CCS to generate PHP code to query a SQL Server 2008 R0 database. I believe that CCS may not be properly generating code to connect to the database.

-SQL Server 2008 R0
-Running SQL Server 2008 R2 Native Client on SQL server box (R2 required for latest PHP drivers)
-Apache Web Server 2.2 running on WinXp Pro SP3
-PHP 5
-Windows IE 8.0
-(Apache Server, PHP, SQL server all on same physical box. CCS on different box)
-Downloaded latest MS SQL Server/PHP drivers and put them in PHP Extensions folder
-Have added these dynamic extensions in PHP.ini

Have disabled all protocols for SQL Server and Native client except TCP/IP. (Also tried it with Shared Memory turned on since SQL prefers this protocol when running on the same physical box as its client but to no avail.)

Behaviors noted:
1. I can create a very simple PHP/html page using code I write myself, place it in my HTDocs folder and it can access data from the SQL server without a problem and display in browser => Apache can access the SQL server in certain cases using PHP.
2. In CCS, I can pull up the data table for a web page in "design view" and use the VIEW LIVE DATA button to see data in the SQL Server tables => CCS can access the SQL Server across the network (using either a DSN or simple username/password connection string).

Error messages:

I cannot use the Live Page option in CCS to view the page. Error says "This program cannot display this page."

When I try to open a php page in a browser with code generated from CCS, and using either a username/password connection string or a system DSN connection, I get:

Database error: Cannot connect to mssql Database

However, none of my SQL server logs are showing an error so it appears that the request is not even making it to the SQL server. It seems to be erroring out in the Apache web server.

I am brand new to Apache and PHP so I may be overlooking something simple. Any help would be appreciated. In VB there are ways to step through the code line by line and see what errors out. Can this be done in Apache/PHP?

View profile  Send private message

Posts: 838
Posted: 04/06/2011, 1:56 AM

im sorry i havent worked with sql 2008 and codecharge
in the absence of any other responses i would contact support to see if 2008 is in fact supported.

if you found this post useful take the time to help someone else.... :)
View profile  Send private message

Posts: 8
Posted: 04/06/2011, 9:52 AM


I got this working. I did several things. Here are my settings for SQL Server 2008

In the CCS connection string builder:


1. Gave it a random connection name
2. Chose SQL SERVER as the DATABASE setting
3. Chose USE CONNECTION STRING instad of ODBC Data Source
4. Used the BUILD button for the connection string:
4.1 PROVIDER tab: Used Microsoft OLE DB Provider for SQL Server
4.2 CONNECTION TAB. Entered the server name as MyServerBoxName\SQLServerInstanceName
4.3 Entered a User name and password for a user in SQL Server with permissions to the target SQL Server database. ALLOW SAVING PASSWORD is checked.
4.4 Picked the nae of the actual SQL database I wanted to target. Make sure to use the TEST Connection button.
4.5 ADVANCED tab - left blank.
4.6 Close that which should take you back to the Connection string builder



1. PHP Database library = SQL SERVER
2. Database name = SQL database that you want to target

3. In the HOST box: Added the name of physical SQL server box to the SQL Server instance. Ie


4. In the LOGIN box: Added the domain to the login name. IE

MyDomainLogin\MyDomainPassword (Note: I am using mixed mode SQL authentication. This login and password are for the physical server, NOT the SQL Server database.)


Also, you can right click on a connection, go to properties, go to the DATA tab and add the SERVER PORT for SQL Server which is 1433. All previous settings can be edited there.

Make sure to read the original post in this string. A lot of other things were done besides this connection string which may be important as well including adding directives, downloading latest PHP drivers from Microsoft, turning off some protocols, and installing the R2 native client. Really not sure what steps are critical but in any event, it works....good luck.
View profile  Send private message
Posted: 04/06/2011, 10:00 AM

Good stuff. Thanks for sharing.

Add new topic Subscribe to topic   

These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit

Web Database

Join thousands of Web developers who build Web applications with minimal coding.

Home   |    Search   |    Members   |    Register   |    Login

Powered by UltraApps Forum created with CodeCharge Studio
Copyright 2003-2004 by  and YesSoftware, Inc.