Solved

Connection to SQL Anywhere does not show up in sa_conn_info()

Posted on 2013-05-10
12
317 Views
Last Modified: 2013-05-14
I have a web page using PHP ( 5.2.6 )
I connect to a sql anywhere database ( version 10 or 11 or 12 )

$_SESSION['CONN'] = sqlanywhere_connect("eng=mysrv;uid=me;pwd=***;dbn=sybase");
$TSTRES = sqlanywhere_query($_SESSION['CONN'],"select stuff from mytable");
$TSTROW = sqlanywhere_fetch_array($TSTRES);

I connect fine and get data fine.

HOWEVER - I need to see this connection from the sa_conn_info()
It does not show up here.

1.  Why not ?

2.  How do I make it show up ?

Thanks !!!
0
Comment
Question by:Brook Braswell
  • 6
  • 6
12 Comments
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39156314
Where are you getting those functions?  sqlanywhere_connect isn't part of PHP as such.  And the code I see for 'sqlanywhere' isn't either.  http://www.sybase.com/detail?id=1057714
0
 
LVL 14

Author Comment

by:Brook Braswell
ID: 39156350
It is what I had learned to use since I started with iAnywhere 10
0
 
LVL 14

Author Comment

by:Brook Braswell
ID: 39156365
As I look on my server I see the php-5.2.5_sqlanywhere10.dll
0
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39156409
Ok, those functions must be old versions for that driver.  The current API docs are located at http://dcx.sybase.com/index.html#1100/en/dbprogramming_en11/php-api.html%23d4e31462  SAP may have discontinued the old driver when they bought Sybase.

And believe it or not, they seem to have a separate driver / extension for almost every version of PHP on this page: http://scn.sap.com/docs/DOC-40537 although I notice that they don't have '10' at the end of the file name.   It also says there:

The PHP modules require SQL Anywhere 10.0.1.3767 or greater.
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39156426
Ooh... I just tried the link to the Developer's edition of SQL Anywhere 10 and the link redirected me to SAP and a free Trial version instead.
0
 
LVL 14

Author Comment

by:Brook Braswell
ID: 39156726
I changed to the php-5.2.6_sqlanywhere.dll  ( iAnywhere 11 )
this did change a little bit...
The connection DID show in the sa_conn_info but only for a split second.
How would I "Keep" this connection ?
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39156844
I have never worked with SQL Anywhere but in all other PHP database connections, they are normally closed at the end of the script each and every time.  I don't know what you mean by "Keep" this connection".
0
 
LVL 14

Author Comment

by:Brook Braswell
ID: 39161118
Keep the connection open...that would be the ideal situation is to connect to the db with php and the connection stay open as long as the browser session is open.
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39162384
No, that just ties up server resources without anything useful being done.  On a busy SQL server, that could cripple it.  Most servers only allows a limited number of simultaneous connections.  To use them up by 'staying on hold' is not a good use of resources.  It is unusual for an SQL request to take more than a few milliseconds so the rest of it would be wasted time on hold.
0
 
LVL 14

Author Comment

by:Brook Braswell
ID: 39162790
In VB using ADO an app can make a connection to a database and not close the connection
This then shows users connected to the database and allows an application to control licenses by viewing active connections.  I am realistically looking for the same thing within PHP to connect to a database and not necessarily do anything but take up my connection license.
I am sure there may be other ways to take up my license but would have to do some "tricks" to know that a user has a browser opened to my app page and know when they are gone.
0
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 39162888
You won't find the same thing in PHP.  'Persistent Database Connections'  http://php.net/manual/en/features.persistent-connections.php  is the closest thing you will find.  And even they will timeout and disappear.  

And I'm not sure you will find the thing you're talking about even in ASP on IIS that uses VB using ADO.  Typical IIS timeout is 30 seconds of inactivity and then it shuts down the procedure.  Web servers don't like blocking connections like that.
0
 
LVL 14

Author Comment

by:Brook Braswell
ID: 39164426
I will find an alternative that will eventually work as a kluge :-(
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question