Solved

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

Posted on 2013-05-10
12
309 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 82

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
 
LVL 82

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 82

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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 82

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 82

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 82

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now