Solved

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

Posted on 2013-05-10
12
327 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
WordPress Tutorial 1: Installation & Setup

WordPress is a very popular option for running your web site and can be used to get your content online quickly for the world to see. This guide will walk you through installing the WordPress server software and the initial setup process.

 
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

Get HTML5 Certified

Want to be a web developer? You'll need to know HTML. Prepare for HTML5 certification by enrolling in July's Course of the Month! It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
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 …

623 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