Phalanger 3.0 and MS SQL Server
13 posts
• Page 1 of 2 • 1, 2
Phalanger 3.0 and MS SQL Server
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?
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
Add following into your app.config, into <phpNet><classLibrary> section
This enables MSSql extension, and all mssql_ functions.
- Code: Select all
<add assembly="PhpNetMsSql, Version=3.0.0.0, Culture=neutral, PublicKeyToken=2771987119c16a03" section="mssql"/>
This enables MSSql extension, and all mssql_ functions.
Jakub Misek │ DEVSENSE s.r.o. | @misekjakub │ jakub@devsense.com │
-
Jakub Misek - Posts: 2092
- Joined: January 4th, 2012, 2:42 pm
- Location: Prague
Re: Phalanger 3.0 and MS SQL Server
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
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
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.
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
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?
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. | @misekjakub │ jakub@devsense.com │
-
Jakub Misek - Posts: 2092
- Joined: January 4th, 2012, 2:42 pm
- Location: Prague
Re: Phalanger 3.0 and MS SQL Server
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.
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
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.
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. | @misekjakub │ jakub@devsense.com │
-
Jakub Misek - Posts: 2092
- Joined: January 4th, 2012, 2:42 pm
- Location: Prague
Re: Phalanger 3.0 and MS SQL Server
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.
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
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. | @misekjakub │ jakub@devsense.com │
-
Jakub Misek - Posts: 2092
- Joined: January 4th, 2012, 2:42 pm
- Location: Prague
13 posts
• Page 1 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 39 guests