Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2013-05-10
12
Medium Priority
?
329 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 84

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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 84

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 84

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 84

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 84

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 84

Accepted Solution

by:
Dave Baldwin earned 1500 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

660 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