Solved

PHP ODBC Connection

Posted on 2010-09-15
13
1,235 Views
Last Modified: 2013-11-15
I have been working on this for months.  I have finally successfully been able to connect to the Timberline database through PHP and a web browser using and ODBC connection.  This is for a future Intranet website we are implementing for our company.

What I have created is a form page when submitted, that username and password is sent to the odbc_connect command.  This connects fine with only one specific user.  When resetting iis and starting up the web page again, i am able to connect again with a different user but only that user i use...  no other.

What is causing the odbc connection to remain only available to one user at a time?  I have used odbc_close to close the connection but it only seems to "officially close" if i run iisreset and start the web page again.


$conn = odbc_connect('Driver={Timberline Data};DBQ=\\\\path\\to\\database\\','username','password');

Open in new window

0
Comment
Question by:the-miz
  • 6
  • 5
  • 2
13 Comments
 
LVL 41

Expert Comment

by:pcelba
ID: 33682114
It seems the first connection is exclusive and it should be some database property which restricts number of concurrently connected users. You have to check database docummentation for more details. BTW, are you able to connect the database from two different client tools?

odbc_close may fail e.g. when some transaction is open.

You have to check error messages by monitoring backend database in some SQL profiler when the connection attempt fails or ODBC closing is not complete.
0
 

Author Comment

by:the-miz
ID: 33683033
What I have noticed is I can open the database with Excel and read a table into it, but to read another table into it, I must use the same username and password.  I have to close the Excel program and re-open it to use a different login.

I'm assuming this is the same with my php intranet site.  That it sees the w3wp as the application accessing it.  I can only use that specific username and password, if I want to you a different one, I must run iisreset to restart my intranet website.

I can login with different users with different tools, for example...  login with Excel and then login with Access with another.

I think I need someone that knows the Timberline database well, in order to tell me how I may allow concurrent uses to use the same application.
0
 
LVL 41

Expert Comment

by:pcelba
ID: 33683258
Yes, unfortunately.

Why you don't use e.g. MySQL which is better supported?
0
 

Author Comment

by:the-miz
ID: 33684802
I'd love to use MySQL but the software my company uses is the Sage Timberline Office, which also somehow uses the Pervasive database in order to connect to its DB.  I'm trying to find a way to make the database think that the application has stopped using the database in order for another users login can be used through the intranet page.
0
 
LVL 41

Expert Comment

by:pcelba
ID: 33685047
If the company decided about the database then it was probably due to the good reliability, support and documentation, so it should not be a problem to find such simple thing.
0
 

Author Comment

by:the-miz
ID: 33685511
Should not be a problem to find such a simple thing?  And this is your "expert" comment/solution.  I hope I'm not paying for access to this exchange for cop-out comments like that.
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 41

Expert Comment

by:pcelba
ID: 33685725
I am just a volunteer as other experts here and no one of use will see your money...

I know this answer cannot give you a satisfaction but you should understand not all specific and niche market products can be supported here and Sage software is so rarely used that it is really hard to find expert which would be waiting here for this kind of question. (I am here over one year and this the first question about the Timberline database.)

The question is still in your hands. You may delete it, you may accept some of your comments as an answer, etc. All possible options are described in help section.

BTW, didn't you use  limited Timberline ODBC driver. The full version is a paid product.
0
 
LVL 18

Accepted Solution

by:
mirtheil earned 500 total points
ID: 33687574
"What I have noticed is I can open the database with Excel and read a table into it, but to read another table into it, I must use the same username and password.  I have to close the Excel program and re-open it to use a different login. "

What error are you actually getting?  From  a Pervasive DB perspective there is no limit on a specific user logging in.  
There are a number of Sage (including Timberline) users doing what you want.  
0
 

Author Comment

by:the-miz
ID: 33691745
Basically here are my steps and error message I get in Excel 2007:

Click the Data Tab, Click Connections, Add a connection using the ODBC Timberline driver.  This prompts me for my Timberline Username and Password.  It allows me to select a table.  This adds the connection to the list and I close the pop-up window.

I then go to Existing Connections and double-click the connection I just created, this prompts me on how I would like to import the data into the spreadsheet.

When I go back after filling my data into the spreadsheet and attempt to add another connection with a different Timberline Username and Password I get the error that it is an Invalid user or password specified.  Which I know it is not.

Now I got the run-around from Timberline about its database.  One told me they no longer use Pervasive but an SQL base DB, yet Pervasive gets installed on our workstations and if I run W3MONV75 I can see who is connected and what files are in use.

We have the paid product of Timberline and full support from them, but that does not include back-end or development support.
0
 
LVL 18

Expert Comment

by:mirtheil
ID: 33691944
Can you post the exact error you get?  Are you getting the same error through PHP?  Do you have a Pervasive ODBC driver listed in ODBC Administrator?  Can you point to that instead of the Timberline driver?  
0
 

Author Comment

by:the-miz
ID: 33693466
The exact error is a alert message box Logon Error  Invalid user id or password specified.  This is only in Excel, PHP does not send out an error message, at least I have not been able to receive one other than it cannot connect to the database.

I am confused how Pervasive even works..  when I connect to using Pervasive's driver, there are only 3 databases in there, one called DEFAULTDB, DEMODATA, TEMPDB.  When I connect using PCC tool it shows me these databases but nothing in them except in System Objects, Tables.
0
 
LVL 41

Expert Comment

by:pcelba
ID: 33696390
I've been asking already but I have to ask again: Does your database have something like Profiler? It will report all traffic on the backend and all errors which will appear. Also if you connect from .NET then the error message will appear including error number which is then traceable in documentation.
0
 

Author Closing Comment

by:the-miz
ID: 33906407
Use workaround
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Save conflict messages on existing documents 15 55
PHP warning 4 30
Method for submitting dynamically created rows 20 17
PHP get array item with custom id 4 24
Read about achieving the basic levels of HRIS security in the workplace.
Never store passwords in plain text or just their hash: it seems a no-brainier, but there are still plenty of people doing that. I present the why and how on this subject, offering my own real life solution that you can implement right away, bringin…
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…
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 …

896 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

15 Experts available now in Live!

Get 1:1 Help Now