Page 1 of 1

Connect MS SQL Server from mysql project

Posted: Sat Aug 24, 2013 1:00 am
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"


Re: Connect MS SQL Server from mysql project

Posted: Sat Aug 24, 2013 9:56 am
by danielc

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


Re: Connect MS SQL Server from mysql project

Posted: Sat Aug 24, 2013 11:16 am
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.


Re: Connect MS SQL Server from mysql project

Posted: Mon Aug 26, 2013 9:44 am
by Bishu

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


Re: Connect MS SQL Server from mysql project

Posted: Mon Aug 26, 2013 9:50 am
by mobhar

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


Re: Connect MS SQL Server from mysql project

Posted: Mon Aug 26, 2013 10:25 am
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.


Re: Connect MS SQL Server from mysql project

Posted: Mon Aug 26, 2013 10:44 am
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.