Connect MS SQL Server from mysql project

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
Bishu
User
Posts: 432

Connect MS SQL Server from mysql project

Post by Bishu »

i am using mysql project and I would like to connect the external database of MS SQL Server 2005
I wrote the commans as -

$conn2 = ew_Connect("host2", "user2", "pass2", "db2");

I got an error "Warning: Creating default object from empty value in"


danielc
User
Posts: 1599

Post by danielc »

ew_Connect is expecting $info (which is an array). You have to assign the value first.


Webmaster
User
Posts: 9438

Post by Webmaster »

Do not use ew_Connect as ew_Connect is generated for database type of your project only (in this case MySQL).

To connect to an external MS SQL Server database, use native codes. For example:

$conn2 = ADONewConnection('ado_mssql');
$conn2->Connect("<connection string>", FALSE, FALSE);

Alternatively, you can generate another project for MS SQL see what the ew_Connect codes look like.


Bishu
User
Posts: 432

Post by Bishu »

I got an error
Fatal error: Call to undefined function ADONewConnection()


mobhar
User
Posts: 11905

Post by mobhar »

Webmaster wrote:
Alternatively, you can generate another project for MS SQL see what the ew_Connect codes look like.


Bishu
User
Posts: 432

Post by Bishu »

Thanks mobhar for your valuable time to reply my question.

I generated a ms sql project and go through the ew_connect
there it is using
$conn = ADONewConnection('ado_mssql');

but when I use in the mysql project as
function Page_Loading() {
$conn2 = ADONewConnection('ado_mssql');
$conn2->Connect(-----------------------------------------);
}

I got an error as
Fatal error: Call to undefined function ADONewConnection()

So can anyone help me to find out where the function ADONewConnection() is store.


mobhar
User
Posts: 11905

Post by mobhar »

Bishu wrote:
So can anyone help me to find out where the function ADONewConnection() is store.

It is located in your generated "phpfn10.php" which will depend on the "adodb.inc.php" file under the "adodb5" sub folder. Please note that you have to insert that new SQL Server connection function either into your "phpfn.php" template file or "phpfn10.php" file so that it can be accessed anywhere from your desired server event. Refer to the related generated code that suits with your database connection.


Post Reply