Solved

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

Posted on 2013-05-10
12
321 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
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 
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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
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 is …
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

730 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