Phalanger 3.0 and MS SQL Server

Discussion about the open-source Phalanger [?] project.

Phalanger 3.0 and MS SQL Server

Postby dbuerer » September 5th, 2013, 3:28 pm

I see from the release notes that "MSSQL is Microsoft SQL extension using SqlConnection internally to increase performance. It also ensures compatibility with latest Microsoft SQL servers."

I am looking for documentation on how to use it, initialize it, make it work and i can't find any code samples or docuemntation.

FYI - I'm writing console. I've tried both the sqlsrv and mssql functions as i would normally in php and neither are working.

I've added the extension into my machine.config file but that didn't seem to help either.
<add assembly="php_msql.mng, Version=3.0.0.0, Culture=neutral, PublicKeyToken=4ef6ed87c53048a3" section="msql" />

Can someone please point me in the right direction?
dbuerer
 
Posts: 7
Joined: September 5th, 2013, 3:24 pm

Re: Phalanger 3.0 and MS SQL Server

Postby Jakub Misek » September 5th, 2013, 3:44 pm

Add following into your app.config, into <phpNet><classLibrary> section
Code: Select all
<add assembly="PhpNetMsSql, Version=3.0.0.0, Culture=neutral, PublicKeyToken=2771987119c16a03" section="mssql"/>
(instead of php_*.mng)
This enables MSSql extension, and all mssql_ functions.
Jakub Misek │ DEVSENSE s.r.o. | @misekjakubjakub@devsense.com
User avatar
Jakub Misek
 
Posts: 2092
Joined: January 4th, 2012, 2:42 pm
Location: Prague

Re: Phalanger 3.0 and MS SQL Server

Postby dbuerer » September 7th, 2013, 2:28 pm

Jakub - thank you for your very quick replay. Is this documented somewhere? Just curious if there's a place I should've found it but didn't. I'm very new to Phalanger but excited about learning.
dbuerer
 
Posts: 7
Joined: September 5th, 2013, 3:24 pm

Re: Phalanger 3.0 and MS SQL Server

Postby dbuerer » September 9th, 2013, 2:49 pm

That worked great. It now recognizes the function and tries to connect but it fails connection to the server. I can connect fine using identical parameters from ODBC. Are there other dependent libraries I need to include and/or install?
dbuerer
 
Posts: 7
Joined: September 5th, 2013, 3:24 pm

Re: Phalanger 3.0 and MS SQL Server

Postby dbuerer » September 10th, 2013, 2:05 am

interestingly enough, the specific error i'm getting is as below. It claims named pipes is being used as the provider....but i'm not using named pipes- i'm supposed to be using tcp. This is strange.

Warning: mssql_connect(): Cannot open connection: A network-related or instance-
specific error occurred while establishing a connection to SQL Server. The serve
r was not found or was not accessible. Verify that the instance name is correct
and that SQL Server is configured to allow remote connections. (provider: Named
Pipes Provider, error: 40 - Could not open a connection to SQL Server) in C:\xMy
Data\VBPROJ\KWH Normalize Application\KWH Normalize\KWH Normalize\SQLsrv2MSSQL.p
hp on line 20, column 5.
dbuerer
 
Posts: 7
Joined: September 5th, 2013, 3:24 pm

Re: Phalanger 3.0 and MS SQL Server

Postby Jakub Misek » September 12th, 2013, 1:45 pm

Phalanger builds connection string using this method

https://github.com/DEVSENSE/Phalanger/b ... on.cs#L112

(parameters of this method are the same as privided to mssql_connect() function)

Can this be an issue?
Jakub Misek │ DEVSENSE s.r.o. | @misekjakubjakub@devsense.com
User avatar
Jakub Misek
 
Posts: 2092
Joined: January 4th, 2012, 2:42 pm
Location: Prague

Re: Phalanger 3.0 and MS SQL Server

Postby dbuerer » September 12th, 2013, 5:12 pm

Jakub - thank you. The connection string seems to be buildlign exactly the way it was expecxted and i was still getting the error message. I discovered a work around where i disabled the named pipes protocol so TCP/IP is the only working one and now it's connecting great. For some reason the PHP mssql driver wasn't having this problem. It's working though so i guess the immeidate need is resolved.

Thank you.

P.S. I have a routine that in PHP takes about 20 minutes to run...doing a lot of data access and processing. I'm hoping this speeds it up a lot...we'll see how it goes.
dbuerer
 
Posts: 7
Joined: September 5th, 2013, 3:24 pm

Re: Phalanger 3.0 and MS SQL Server

Postby Jakub Misek » September 12th, 2013, 5:17 pm

Great! I'm glad it is solved.

Please give me know if we could improve something. Note Phalanger is using native Microsoft driver to connect to MSSQL, and it has very fast data copying from DB to PHP; still in general, most of the time takes unoptimized SQL query.
Jakub Misek │ DEVSENSE s.r.o. | @misekjakubjakub@devsense.com
User avatar
Jakub Misek
 
Posts: 2092
Joined: January 4th, 2012, 2:42 pm
Location: Prague

Re: Phalanger 3.0 and MS SQL Server

Postby dbuerer » September 13th, 2013, 10:25 pm

So I got the code to compile and run at least for test. The code does a bunch of data intensive processing and validation.

Both code uses exactly the same files with modifications only on the way classes are included. In the original PHP version they are all dynamically loaded based on some network variables. In the Phalanger version I was having trouble getting this to work quickly so I just did a bunch of hard includes. If I go to production with it i'll have to resolve this.

The PHP Code took 28m:09s to run.
The Phalanger compiled version of the PHP code took 26:55 to run.

Not as much as i was hoping for. I was hoping it would magically come down to about 5 minutes.
dbuerer
 
Posts: 7
Joined: September 5th, 2013, 3:24 pm

Re: Phalanger 3.0 and MS SQL Server

Postby Jakub Misek » September 14th, 2013, 12:59 am

Do you have some more information, e.g. whether it is all during DB querying? Or if it includes time spent in PHP code. The PHP code can be usually optimized.
Jakub Misek │ DEVSENSE s.r.o. | @misekjakubjakub@devsense.com
User avatar
Jakub Misek
 
Posts: 2092
Joined: January 4th, 2012, 2:42 pm
Location: Prague

Next

Return to Phalanger project

Who is online

Users browsing this forum: No registered users and 4 guests

cron

User Control Panel

Login

Who is online

In total there are 4 users online :: 0 registered, 0 hidden and 4 guests (based on users active over the past 5 minutes)
Most users ever online was 124 on September 25th, 2020, 6:57 am

Users browsing this forum: No registered users and 4 guests