Re: [PHP-DB] Ms Sql stored procedures with parameters
Hane you tried $result = mssql_query(EXEC getSomeCoolData '061451221', NULL, NULL ); Also, did you try mssql_init()? -- bob On Wed, 4 Jan 2006, meska wrote: Hi, I've done it in various ways, still, no luck.. Lets say i have a stored procedure getSomeCoolData declared as : [getSomeCoolData] @prodCode char(255), @prodName nvarchar(255), @prodID int = NULL This stored procedure returns products based on parameters i pass. So let's say i do like this in Enterprise manager: EXEC getSomeCoolData @ prodName = NULL, @prodCode = '061451221' And i get one product - good ! (by unique code) Now, let's say i'll do the same in php: $result = mssql_query(EXEC getSomeCoolData @ prodName = NULL, @prodCode = '061451221'); BAM ! I get all the products, as all parameters where supplied as NULL or '' ( stored procedure checks for parameters, and if they are '' , it asigns null. Have tried various ways, still the same. Have tried to use http://www.sitepoint.com/article/php-microsoft-sql-server/2 - the same Any ideas? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] SQL Server - do I need PHP to run COMMIT?
Using COMMIT is only required if you issued a BEGIN TRANS before your INSERTs, UPDATEs and / or DELETEs. All transactions are automatically committed if you don't use BEGIN TRANS. Are you backing up the transaction logs regularly? -- bob On Fri, 16 Dec 2005, Alex Gemmell wrote: Hello people, My PHP application uses a SQL Server 2000 database. I have previously only ever used MySQL and so my knowledge of SQL Server comes just from experimentation and trial and error experience. My PHP application appears to be working fine but I have just discovered that although the database itself is rather small on the disk (about 25MB) the transaction log file is huge (400MB). I have had a quick look at Microsoft's website about large transaction files and they suggest many reasons, one of which is the application not COMMITing transactions. This is certainly true because I simply make INSERT and UPDATE queries but don't include a COMMIT statement. So my question is this: should I be COMMITing? How do I do that? Do I simply run something like this after every INSERT/UPDATE/DELETE: mssql_query('COMMIT', $link_identifier); Please help - I feel like I'm missing a trick here. FYI: I'm also now doubting my use of mssql_pconnect() - should I being using mssql_connect() with mssql_close() instead? Thanks, Alex -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] SQL Server - do I need PHP to run COMMIT?
Do you have the truncate log on checkpoint option enabled? Also, if you want to reduce the size of the log file if shrinking doesn't work, try running the following against the database. Of course, you should backup the DB first. SET NOCOUNT ON DECLARE @LogicalFileName sysname, @MaxMinutes INT, @NewSize INT -- *** MAKE SURE TO CHANGE THE NEXT 4 LINES WITH YOUR CRITERIA. *** USE [CLEANUP] -- This is the name of the database -- for which the log will be shrunk. SELECT @LogicalFileName = 'FHMMSYS_Log', -- Use sp_helpfile to -- identify the logical file -- name that you want to shrink. @MaxMinutes = 10, -- Limit on time allowed to wrap log. @NewSize= 100 -- in MB -- Setup / initialize DECLARE @OriginalSize int SELECT @OriginalSize = size -- in 8K pages FROM sysfiles WHERE name = @LogicalFileName SELECT 'Original Size of ' + db_name() + ' LOG is ' + CONVERT(VARCHAR(30),@OriginalSize) + ' 8K pages or ' + CONVERT(VARCHAR(30),(@OriginalSize*8/1024)) + 'MB' FROM sysfiles WHERE name = @LogicalFileName CREATE TABLE DummyTrans (DummyColumn char (8000) not null) -- Wrap log and truncate it. DECLARE @Counter INT, @StartTime DATETIME, @TruncLog VARCHAR(255) SELECT @StartTime = GETDATE(), @TruncLog = 'BACKUP LOG ['+ db_name() + '] WITH TRUNCATE_ONLY' -- Try an initial shrink. DBCC SHRINKFILE (@LogicalFileName, @NewSize) EXEC (@TruncLog) -- Wrap the log if necessary. WHILE @MaxMinutes DATEDIFF (mi, @StartTime, GETDATE()) -- time has not expired AND @OriginalSize = (SELECT size FROM sysfiles WHERE name = @LogicalFileName) -- the log has not shrunk AND (@OriginalSize * 8 /1024) @NewSize -- The value passed in for new size is smaller than the current size. BEGIN -- Outer loop. SELECT @Counter = 0 WHILE ((@Counter @OriginalSize / 16) AND (@Counter 5)) BEGIN -- update INSERT DummyTrans VALUES ('Fill Log') -- Because it is a char field it inserts 8000 bytes. DELETE DummyTrans SELECT @Counter = @Counter + 1 END -- update EXEC (@TruncLog) -- See if a trunc of the log shrinks it. END -- outer loop SELECT 'Final Size of ' + db_name() + ' LOG is ' + CONVERT(VARCHAR(30),size) + ' 8K pages or ' + CONVERT(VARCHAR(30),(size*8/1024)) + 'MB' FROM sysfiles WHERE name = @LogicalFileName DROP TABLE DummyTrans PRINT '*** Perform a full database backup ***' SET NOCOUNT OFF -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php_mssql - 'space' instead of empty string
I don't think this is an issue with an old vs new ntwdblib.lib. The reason is because I don't belieeve there is a new ntwdblib.lib. Microsoft has not made any changes to this library since SQL Server 6.5. Therefore, the problem lies in the PHP 4.4.0 source code for the mssql extension. -- bob On Thu, 25 Aug 2005, Bartosz Jakubiak wrote: I've found that since PHP 4.3.4 many people had problems with MSSQL extension. PHP developers are saying that is problem with MS libraries, and there is no possibility to fix it in PHP: http://bugs.php.net/bug.php?id=29292edit=1 http://bugs.php.net/bug.php?id=26315edit=1 Right now I'm using PHP 4.4.0, and still have problem with it. I understand that php_mssql binaries are compiled using ntwdblib.lib, and that very library is causing trouble, am I right? Is it possible to recompile php_mssql with old version of ntwdblib.lib (used in PHP 4.3.3) without negative consequences (memory leaks, unstability, whatever)? Or using old PHP 4.3.3 is the only solution? -- Bartosz Jakubiak -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP MSSQL bug
Then, is it safe to assume that you can run stored procedures and queries that don't use a remote linked server? Fundamentally, I don't know why PHP would be the problem, since the remote link is established within the stored procedure. To make sure that it is not a problem with the mssql extension, you should see if the same problem occurs with the odbc or odbtp extensions. -- bob On Mon, 14 Mar 2005, Raul IONESCU wrote: Yes, of course; I'm running under sa credentials so that's not the problem. On Mon, 14 Mar 2005 09:28:15 -0500, Bastien Koert [EMAIL PROTECTED] wrote: Do you have permissions to run the query as the php/webserver user? Bastien From: Raul IONESCU [EMAIL PROTECTED] Reply-To: Raul IONESCU [EMAIL PROTECTED] To: php-db php-db@lists.php.net Subject: [PHP-DB] PHP MSSQL bug Date: Mon, 14 Mar 2005 09:16:40 +0200 I have created a stored procedure wich is accessing an remote linked MSSQL 2000 server and works perfectly from Querry Analyzer. The problem occurs when I try to execute the stored procedure from php 5.0.3 (by using mssql_bind or mssql_query); I've got no error but no result either. It seems that php doesn't allows to access remote linked servers! -- Raul IONESCU -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Raul IONESCU -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Intermittent odbc_connect() problem with iodbc/openlink
Assuming you always connect to the server using the exact parameter values for odbc_connect(), this does not look like an easy one to solve. I also connect to a Sybase database on a Win2K server from PHP/Apache/Solaris. However, I don't use the odbc extension. I use the odbtp extension, which works very well, and has better support. So, you probably will have better results with odbtp, which is available at http://odbtp.sourceforge.net. On Wed, 16 Feb 2005, Crone, James wrote: I'm having intermittent problems with odbc_connect(). Here's the situation I'm trying to connect to a Sybase Adaptive Server Anywhere database running on Win2K from my web server using Solaris, Apache, PHP, iODBC, and OpenLink's ODBC universal data access driver for MSSQL/Sybase. About 75% of the time, my php scripts talk to the Sybase system fine. However, the other 25% of the time nothing really happens. IE reports a Page cannot be displayed error, while Firefox acts like it may do something for a fraction of a second, but then just stays on the currently loaded page. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Access
You have 3 options. Option 1: Use PHP's native odbc extension. This option is limited, and only works on @in32 platforms. Option 3: Use PHP's COM support. This option only works on @In32 platforms, and does not follow the function paradigm of PHP's database extensions. Example code: http://aspn.activestate.com/ASPN/Cookbook/PHP/Recipe/163447 Option 3: Use the ODBTP extension, available at http://odbtp.sourceforge.net. This options allows you to remotely connect to an Access database from any platform. It provides the best support for MS Access. Here is an example of how to use ODBTP to call a MS Accesss stored query: http://odbtp.sourceforge.net/storedqry_php.html Note: All of these options are supported by PEAR DB. -- bob On Wed, 2 Feb 2005, Darryl wrote: Hay, I was just wondering if any of you had any links to websites that explained php programming with Access databases. Thanks in advance, Darryl -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] how to connect to dbase
Try odbtp, http://odbtp.sourceforge.net. -- bob On Fri, 15 Oct 2004, Swapan Mazumdar wrote: Hi All, I am quite new to php. I have a requirement to query dbase file to implement searching on table columns. Now I am following a basic approach using dbase_get_record_with_names($fileHandler, $iterationIndex). This seems to be a rudimentary approach and has performance bottleneck. For the purpose of paging this is a big stopper. I request php guys to show me how to use Connection to fire a query. I am afraid I can't use system dsn since the underline dbase file could be dynamic. Pl. suggest me how to use direct connection through url or file dsn. This is in context to web apps development. Regards, Swapan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] microsoft access
ADODB is a PHP abstraction layer class. In other words it hides the fact that it is using the odbc extension to connect to Access. And, it has another driver that uses the COM extension to connect to Accesss (ado_access). Basically there are only 3 options for connecting to Access from PHP. They are odbc, COM and odbtp. So, the comparison must be done amongst them, and not with an abstraction layer that uses them. -- bob On Fri, 1 Oct 2004, Gryffyn, Trevor wrote: I'm guessing that COM is going to be overkill for this. I thought some systems like ADOdb let you get to Access tables directly without COM. I'm imaginging that COM might not always be a viable way to go anyway, if you have an Access .MDB file on a server where your PHP stuff is hosted, they probably don't have Access installed on their server (why would they?). If I have time later, I'll double-check ADOdb and such, but I'd look into something like that before I'd use COM. -TG -Original Message- From: Matt M. [mailto:[EMAIL PROTECTED] Sent: Friday, October 01, 2004 11:54 AM To: Matthew Perry Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] microsoft access Does anyone know of a good online source for using php and microsoft access. I don't want to have to use asp. Thank you for your time. you could use com objects with Microsoft ADO -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] microsoft access
Hi Trevor ODBTP is a technology that allows you to remotely access a Win32 machine's ODBC facilities to connect to a database. IF provides faster and more advanced support for ODBC than PHP's native support. For example, ODBTP connects to a database using ODBC 3, while PHP's native ODBC support uses ODBC 2. -- bob On Fri, 1 Oct 2004, Gryffyn, Trevor wrote: Thanks for the clarification, Bob. ADOdb is one of those things that I use, but don't really think about much so terms like abstraction layer didn't come immediately to mind. So in the interest of not sounding like a dumbass and using the wrong terms, I just kept my response vague :) At any rate, COM is still going to require Access to be installed. ODBC I have experience with, so that sounds like the best route for general use. And I have no experience with odbtp, so can't really judge on that one. Anyway, thanks again Bob, input is goood. -TG -Original Message- From: Robert Twitty [mailto:[EMAIL PROTECTED] Sent: Friday, October 01, 2004 2:27 PM To: Gryffyn, Trevor Cc: [EMAIL PROTECTED]; Matt M.; Matthew Perry Subject: RE: [PHP-DB] microsoft access ADODB is a PHP abstraction layer class. In other words it hides the fact that it is using the odbc extension to connect to Access. And, it has another driver that uses the COM extension to connect to Accesss (ado_access). Basically there are only 3 options for connecting to Access from PHP. They are odbc, COM and odbtp. So, the comparison must be done amongst them, and not with an abstraction layer that uses them. -- bob -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: Accessing Matisse DB
On Thu, 16 Sep 2004, Petrus Ali Saputra wrote: John Holmes wrote: Petrus Ali Saputra wrote: Petrus Ali Saputra wrote: Is there anyone here can tell me how to access Matisse DB? Thank you. Isn't there anyone can help me? ODBC? Yes, but it will lower the ability of Matisse. Please elaborate on how the use of ODBC will lower the ability of Matisse. Are there aspects of Matisse that can't be done with SQL? Unless you can find a PHP extension for Matisse, then your only alternative is ODBC. -- bob -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Sybase Peristent Connections Gotchas
Hi Brian Why don't you just avoid using sybace_pconnect() with transactions? I use ODBTP to connect to SQL Server and Sybase databases, and this is not an issue. The reason is because ODBTP involves the use of a mediating service that pools all connections, and automatically rollbacks transactions upon client disconnection. The odbtp extension does not support persistent connections, since they are pooled by the ODBTP server. And, if an odbtp script aborts, the odbtp client connection will be terminated, which will cause the odbtp server to rollback the transaction. However, the underlyning database connection will still be pooled by the server for use by another client. Persistent connections may not be the best way to implement database connection reusage. Not only are they subject to undesirable open transactions, they will never timeout, and a single web client can cause a database connection to remain open for each web server child process. Connection pooling may be a better alternative, however, it requires a middle-man server to manage the pool. Unfortuantely, ODBTP requires the server to be placed on a Win32 host that can access the database with its local ODBC facilities. For some developers, this is not always feasible. If it's feasible for you, then your problem will be solved by using the odbtp extension. Otherwise, you can't use persistent connections. -- bob On Wed, 15 Sep 2004, Brian Foddy wrote: On transactions, no this is my biggest concern. Say a php script performs a begin tran then aborts early due to an error (user error for instance), but the script error handling fails to rollback the transaction before it exits. Just 1 poorly coded script. Now the begin tran is still open, the next page served by that apache process inherits an open transaction. Even if it is coded and perform perfectly with its own begin / commit trans (remember you can nest trans), the transaction is ultimately never commited; but there is almost no indication to the script. This keeps going and going making this uncomitted trans bigger and bigger, locking more and more records. Finally one of 2 things will happen. 1. The locks get so big that users may get blocked or the max locks exceed the sybase config. 2. The apache process may actually exit if its defined for a max usage or is trimmed by the web server due to max running daemons. In case 1, application support would probably restart the web server to release the locks. In case 2 apache itself does it. Either way, the transaction and all the subsequent nested ones will be rolled back, as if they never occurred. It could be a big database headache. The best way I can forsee to prevent this is to always perform a rollback tran after a call to sybase_pconnect to make sure there isn't an unclosed trans. As for the other points you make, I was expecting to perform a sybase_pconnect each execution anyway so that is automatic. I'm not sure how I can reset the handle in Sybase? If its possible I'd like to know how. The more I think about this, it seems that this whole thing is more work than its worth. But if someone sees some effective ways to handle some of these issues I'd like to hear them. Brian Jeff Moss wrote: The biggest problem I've had with persistent connections is the problems that arise when the connection goes down. You have to monitor the connection status anyways (and reconnect on a failure), so it was usually easier to just connect every time. I don't know if this is specific to sybase. You also avoid headache dealing with multiple connections per process. Over a local ethernet this was usually such a short delay that it didn't matter. Typically I don't care much for speed, you avoid a lot of headache avoiding the persistent connections, but the tradeoff is speed of course. It seems to make a lot more sense to me to just reset the handle to drop all temp tables and that. As for the transactions, I think as long as you do the transaction all at once there would be no problem right? If it was a problem in the middle of a socket write, chances are the socket closed also, right? -Jeff Brian Foddy wrote: I've been using PHP4/5 and Sybase for several years, using standard sybase_connect. Today I tried playing around with pconnect to get aquainted. I expected one simple condition of a use database from one web page affecting another, and easilly handled that with a connection wrapper that re-uses the proper database with each reconnection. A couple other more troublesome issues also quickly came up. 1. Any #temp database tables are not destroyed between calls. I can probably work around this with some minor coding changes to manually drop temp tables. 2. Any call to environmental set commands like set isolation remain in effect after the web page is complete. Again with some work I could probably recode some
Re: [PHP-DB] MSSQL FOR XML AUTO php
HI Bozhan When you append the FOR XML clause at the end of a query, the xml data will be sent in a single column result set. The column's type is ntext, which is not easily handled by FreeTDS and PHP. The reason is because it is UC2-2 encoded UNICODE text. UNICODE text is easier to deal with if it is encoded using UTF-8. Somewhere in FreeTDS's docs it talks about how to do this. However, rather than using FreeTDS, I would suggest using ODBTP, which is available at http://odbtp.sourceforge.net. One of its biggest strengths and advantages over FreeTDS is UNICODE data and query processing. It had no problems executing your FOR XML query. It also provides support for all of PHP's mssql functions, so you don't have to change your code. -- bob On Tue, 14 Sep 2004, Bozhan Boiadzhiev wrote: Hello i have such problem Executing this script php code: ?php session_start(); include ../msdb_conn.php; $stmt_page=mssql_init(GET_RESUME_AS_XML); mssql_bind($stmt_page,RETVAL,$returnval,SQLVARCHAR); $execute_stmt=mssql_execute($stmt_page); echo mssql_num_rows($execute_stmt); do { while ($row = mssql_fetch_array($execute_stmt)) { print_r($row); } } while (mssql_next_result($execute_stmt)); ? -- SNIP -- but the only result is: 1Array ( [0] = [XML_F52E2B61-18A1-11d1-B105-00805F49916B] = ) a little simple example: PROCEDURE: CREATE PROCEDURE PRINT_XML_DATA AS SELECT 'data' as col1 FOR XML RAW GO executing this procdure form SQL Query Analyzer gives: XML_----(whaever) row col1=data/ ?php include ../msdb_conn.php; /* $stmt_page=mssql_init( PRINT_XML_DATA); $execute_stmt=mssql_execute($stmt_page); */ // I can execute this way too but whit same result $query=mssql_query(exec PRINT_XML_DATA); echo mssql_num_rows($query); /* while ($row = mssql_fetch_array($query)) { print_r($row); } */ // I can execute this way too but whit same result do { while ($row = mssql_fetch_array($query)) { print_r($row); } } while (mssql_next_result($query)); ? and result is: Array ( [0] = [XML_F52E2B61-18A1-11d1-B105-00805F49916B] = ) -- SNIP -- Can some one to tell me or to suggest me how i can do this thing. And where is the problem in PHP or in FreeTDS or in me:) ??? Thanks Bozhan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] ODBC Column Name Truncation
The reason is because the buffer used by the odbc extension to store field names is only 32 bytes. You can try using the sybase or odbtp extension. Otherwise, you will have to submit it as a bug, so that it will be fixed. -- bob On Thu, 9 Sep 2004, Anthony Robins wrote: When retrieving ODBC results from Sybase SQL Anywhere 6 and 9, the column names are being truncated to 31 characters. -- ?php $DBN = 'thedbn'; $UID = 'theuid'; $PWD = 'thepws'; $CONN = odbc_connect( $DBN, $UID, $PWD ) or die( Cannot connect to $DBN.); $sql = select * from crap; $result = odbc_exec( $CONN, $sql ); for( $i = 1 ; $i = odbc_num_fields( $result ) ; $i++ ) { $name = odbc_field_name( $result, $i ); ${$name} = odbc_result( $result, $name ); print( $i: $name - ${$name}\n ); } ? Result: 1: key - 4 2: a_really_long_name_that_is_long - 5 3: longer_name - 6 I expected #2 to have the name: a_really_long_name_that_is_longer_than_31_characters -- This happens even if the column name is simply specified using sql 'AS' (i.e. select column as a_really_long_name_that_is_longer_than_31_characters from crap would still return a_really_long_name_that_is_long as the column name). Using PHP 4.3.4 on Windows 2000 Server. Have also tried on SUSE Linux as well as with PHP 5. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] odbc_num_rows fails when HAVE_SQL_EXTENDED_FETCH is commented out
If HAVE_SQL_EXTENDED_FETCH is defined, then the odbc ext will use the ODBC API function SQLExtendedFetch instead of SQLFetch to retrieve records. SQLExtendedFetch is only necessary if a forward-only cursor is not being used. In the case of the odbc ext, it uses a dynamic cursor if HAVE_SQL_EXTENDED_FETCH is defined. The problem is that dynamic cursors have the worst performance, while forward-only cursors have the best performance. However, forward-only cursors do not allow you to predetermine the number of rows. This is why you are getting -1 from odbc_num_rows(). A static cursor should have been used instead of a dynamic cursor. While it is not faster than forward-only, it is faster than dynamic, and still allows you to get a row count. -- bob On Thu, 26 Aug 2004, Mahmut Eren wrote: Hi, I'm using php-4.3.3 on mandrake Linux. I had a performance problem accessing to DB2 databases on As400 systems. When I searched the internet I found out that commenting out '#define HAVE_SQL_EXTENDED_FETCH 1' lines from php_odbc_includes.h file could solve the problem. I edited the file and recompiled php; the result was a much better performance. But this time odbc_num_rows() statement fails and always returns -1. How can I solve this problem? Any suggestions? Thanks in advance Mahmut Eren ==- Bu e-posta sadece yukarida isimleri belirtilen kisiler arasinda özel haberlesme amacini tasimaktadir. Size yanlislikla ulasmissa lütfen gönderen kisiyi bilgilendiriniz ve mesaji sisteminizden siliniz. Turkiye Cumhuriyet Merkez Bankasi A.S. bu mesajin icerigi ile ilgili olarak hicbir hukuksal sorumlulugu kabul etmez. This e-mail communication is intended for the private use of the people named above. If you received this message in error, please immediately notify the sender and delete it from your system. The Central Bank of The Republic of Turkey does not accept legal responsibility for the contents of this message. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] IBM DB2
Hi Is anyone using PHP to connect to an IBM DB2 database? The reason why I am asking is becaouse I want to see if the odbtp extension can be used to successfully prepare and execute DB2 stored procedures. So far, ODBTP performs quite well with IBM DB2 in regards to regular queries. -- bob -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] DB2 +Windows +CLOB
The odbtp extension has be used quite successfully with DB2. You can get it at http://odbtp.sourceforge.net. I have not personnally used it with DB2, but there are posts on odbtp's help forum pertaining to DB2. -- bob On Tue, 3 Aug 2004, Javier Mestre wrote: Any example how to use CLOB,BLOB fields with PHP under Windows and DB2 ? Thanks in advance Javier Mestre -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Connect to a ms access on a remote drive
Assuming your PHP script is located on a Win32 server, you will have to run the web server under a user account that has permission to access the remote drive. You then have to reference the MS Access database by its UNC path. -- bob On Mon, 2 Aug 2004, Paul Kain wrote: I am aware that theres a problem with connecting to an MS ACCESS DB on a remote drive. Anyoone how to do it correctly ? Please? :( -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] ODBC avec PHP
You will have much better results if you use the odbtp extension instead of the odbc extenstion, especially on Linux. The odbtp_field_type() function will give you the correct type name. Also, you could use the mssql extension. However, mssql_field_type() returns type names that are not exact. For example, it returns char for all character fields even if their type is varchar, text, nchar, nvarchar or ntext. -- bob On Thu, 8 Jul 2004, Jean-François Léost wrote: hi I want to use the function odbc_field_type on a linux mandrake 10 with PHP 4.3.7 with unixODBC et freeTDS This function never give me a good answer : Example of an answer : Xÿ¿p [EMAIL PROTECTED] [EMAIL PROTECTED]@[EMAIL PROTECTED]@ Someone can help me ? Jeff -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] ODBC avec PHP
The latest version of ADODb supports odbtp. You can get it at http://odbtp.sourceforge.net. There are 2 versions of the ADODb driver: odbtp and odbtp_unicode. The problem you are having is caused by the inability of the ODBC driver to provide what the desired information. The FreeTDS ODBC driver still needs some more work. The odbtp extension currently provides the most complete support for SQL Server 2000. -- bob On Thu, 8 Jul 2004, Jean-François Léost wrote: Hi Thanks for your answer but : What is odbtp extension I don't find it on www.php.net ??? I use ADOdb to database abstraction and I can't change all the ADOdb code. Do you know why the function odbc_field_type don't give me the good result ? Is is a PHP error, an unixODBC error or a freeTDS error ? To acces to MsSqlServer, which ODBC connection do you prefer ? thx to help me Jeff Robert Twitty [EMAIL PROTECTED] a écrit dans le message de news:[EMAIL PROTECTED] You will have much better results if you use the odbtp extension instead of the odbc extenstion, especially on Linux. The odbtp_field_type() function will give you the correct type name. Also, you could use the mssql extension. However, mssql_field_type() returns type names that are not exact. For example, it returns char for all character fields even if their type is varchar, text, nchar, nvarchar or ntext. -- bob On Thu, 8 Jul 2004, Jean-François Léost wrote: hi I want to use the function odbc_field_type on a linux mandrake 10 with PHP 4.3.7 with unixODBC et freeTDS This function never give me a good answer : Example of an answer : Xÿ¿p [EMAIL PROTECTED] [EMAIL PROTECTED]@[EMAIL PROTECTED]@ Someone can help me ? Jeff -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Multiple MSSQL Connections
If this is the problem, then you should try the odbtp/mssql hybrid extension, php_odbtp_mssql.dll. It is thread-safe, and is available at http://odbtp.sourceforge.net. -- bob On Fri, 2 Jul 2004, Frank M. Kromann wrote: That depends on the SAPI you are using. With CGI or FastCGI there is no problem but with ISAPI or Apache module you might get problems, as the DBLIB library used to build the extension is not thread safe. - Frank -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] RE: [PHP-WIN] [ANNOUNCEMENT] ODBTP 1.1.1 Released
If you are using odbtp as a driver for the mssql ext, and want mssql_field_type() to return the actual type name, then call odbtp_set_attr( ODB_ATTR_FULLCOLINFO, 1 ); before you run any queries. -- bob On Thu, 3 Jun 2004, Frank M. Kromann wrote: mssql_field_type() is the function for that. - Frank Robert, Do you have an example of pulling the Column types from an MS Sql query? For example: select top 1 * from mytablename. loop thru the fields in the recordset and print out their data types? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] [ANNOUNCEMENT] ODBTP 1.1.1 Released
FYI for the members of this list that are using ODBTP: Version 1.1.1 has been released, and is available for download at http://odbtp.sourceforge.net Key Changes: * All version 1.1 known bugs have been fixed. * Data truncation detection. * Auto char to wide char mapping for MS Access in UNICODE SQL mode. * PHP 5 support, including Win32 odbtp extension dlls. * PEAR DB driver works with latest DB version. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Using Cursors
Hi I am not aware of a website that talks about cursors. However, I do know that they should be avoided whenever possible. They tend to require a lot of resources. I mostly use them in stored procedures when I need to loop through a result set. If you like, I can provide you with MS SQL Server syntax. Cursors historically are used for grid-based application, and not web-based applications. What are you doing that requires the use of a cursor? -- bob On Tue, 1 Jun 2004, Gerard Samuel wrote: A bit off topic, but lately I've been running into situations, where I have to know about using cursors with databases, like sql server, ibm db2 Can anyone point me to online resources that explains (to a practical newbie) cursors Thanks -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Extending Pear DB class. Is it possible?
It appears that you want to extend DB_coomon not DB. The reason is because $dbh = MyDB::connect( $dsn ); returns an instance of the DB_common class. However, DB_common is the base class for writing a PEAR DB driver class. And, what is really returned by DB::connect() is an instance of the driver class that extends DB_comon. Creating a MyDB_Common will not work either, unless you edit all the DB database driver class files to extend MyDB_common instead of DB_Common. If you are doing this for a specific database, then what you should is extend the corresponding driver class, i.e, mymysql.php. You would then use 'mymysql' instead of 'mysql' as the driver name. What functionallity do you wish to add to DB? -- bob On Mon, 17 May 2004, Ross Honniball wrote: Hi all, I'd like to extend the standard Pear DB class, but there is something a bit curly about it. PHP lets me create a class like: class mydb extends DB { functions etc. } however the new class mydb will not include all the functions. I think it is only including all the functions defined in the 'common.php' file. The 'mydb' class above won't, for example, have the 'query' function, even after successfully connecting to a database. Anyone know how to go about extending the Pear DB class? . . Ross Honniball. JCU Bookshop Cairns, Qld, Australia. . -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Linux/PHP/Access Database - oh boy :(
On Wed, 12 May 2004, Alex Gemmell wrote: Hello all, I am fairly new to Linux/PHP so please bear with me. I have an awfully awkward problem to solve - a stop gap solution for the next 6 months until we have out in-house servers set up and running. I also have a very short timeframe to sort this out. I am using PHP on a remotely hosted Linux web server to build my website, however I have been given a MS Access database to use! Despite my best efforts (and two days Google trawling) I haven't found a suitable solution so I am turning to your collective knowledge. First things first - I do not run the server and cannot install any new tools on to it (I cannot access the folders above my web root). There are lots of suggestions on the net about installing MDBTools and UnixODBC RPM (http://bryanmills.net:8086/archives/99.html) - but that involves the admin who won't do it! I can, of course, put scripts that may help in the actual web folder and reference them if anyone has any ideas. I know I must use a DSN-less connection. I first tried connecting directly to the mdb file using: $conn = new COM(ADODB.Connection) or die (Cannot create ADODB Connection object.); You cannot do this on Linux because I don't believe it supports COM nor OLEDB. If your ISP allows you to use dynamically loadable PHP extensions, then you might be able to use ODBTP. But, this solution requires the use of a Windows machine that can be accessed by the Linux box via port 2799, which may not be possible for you. Thus, your only option would be MDBTools and unixODBC. If your provider won't let you install MDBTools or ODBTP, then your only solution is to get a new provider. -- bob -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Linux/PHP/Access Database - oh boy :(
Hi Alex ADODb will not work either. ADODb is basically a PHP abstraction class library that relies on lower level database extensions to connect to the various databases. The problem for you is that other than the odbc extension combined with MDBTools, and the odbtp extension, there is no other way to connect to an MS Access database from Linux under PHP. BTW, you mention that your other alternaive is to learn ASP. This implies that you will be using IIS on another machine. Can PHP be installed on that machine? -- bob On Wed, 12 May 2004, Alex Gemmell wrote: Thank you Trevor! Funny you should mention ADOdb. I just d/l it and uploaded it to my web site! I am working through the docs now. I was losing hope because I couldn't find what I was looking for but if you don't mind I will help myself to your connection string: case OtherDB: # Sample connect string to Access MDB file $myDSN=PROVIDER=MSDASQL;DRIVER={Microsoft Access Driver (*.mdb)};Dbq='C:\Database.mdb';UID=;PWD=;; I have been using the realpath function of PHP in other connection strings to map the path from the server root to the database location. I assume will work fine here: $myDSN=PROVIDER=MSDASQL;DRIVER={Microsoft Access Driver (*.mdb)}; Dbq=. realpath(prices/mydb.mdb) .;UID=;PWD=;; I'm still not sure this will work. I'm getting a lot of information from people saying a .mdb file (the MS Access database) just can't be accessed this way and I should use an intermediate database format, like .dbf which can be made by exporting the database out of MS Access into dbase 5. Does anyone know what the connection string for a .dbf (dbase 5) format database is? Alex |:| Reply-to: mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] |:| _ From: Gryffyn, Trevor [mailto:[EMAIL PROTECTED] Sent: 12 May 2004 15:09 To: PHP List Cc: Alex Gemmell Subject: RE: [PHP-DB] Linux/PHP/Access Database - oh boy :( First, I don't think you are likely to use COM calls on a linux box since COM and DCOM are MS things aren't they? Even if not, it might require some configuration on the server end which you can't do. I use the ADOdb database library for PHP in all the things I do: http://php.weblogs.com/adodb I have a dbconnect.inc file that has all my connect strings in a switch/case statement that dynamically changes the connect string. I think you can connect DSNLess to an Access database this way. I'll paste a stripped down version of the dbconnect.inc to my message since I don't know if this list accepts attachments. Let me know if you have any questions.. good luck! -TG ?php include(adodb/adodb.inc.php); ADOLoadCode(ado_mssql); $db = ADONewConnection(ado_mssql); switch ($database) { # Cargo System databases case PhotoGallery: # Where the photos are stored $myDSN=PROVIDER=MSDASQL;DRIVER={SQL Server};SERVER=PhotoServe;DATABASE=Photos;UID=username;PWD=password;; break; case UserLogin: # Where the user login information is $myDSN=PROVIDER=MSDASQL;DRIVER={Microsoft ODBC for ORACLE};SERVER=TMPROD;UID=ops;PWD=ops;; break; case OtherDB: # Sample connect string to Access MDB file $myDSN=PROVIDER=MSDASQL;DRIVER={Microsoft Access Driver (*.mdb)};Dbq='C:\Database.mdb';UID=;PWD=;; break; } $db-Connect($myDSN); #$db-debug=true; if ($sqlquery ) { $rs = $db-Execute($sqlquery); if ($rs === false) { print h2Error: ( . $db-ErrorNo() . ) . $db-ErrorMsg() . /h2br\n; } else { $arr = $rs-GetArray(); print Status: ( . $db-ErrorNo() . ) . $db-ErrorMsg() . br\n; } } else { $rs = $db-Execute($sql); if ($rs === false) { print h2Error: ( . $db-ErrorNo() . ) . $db-ErrorMsg().br$sqlbr\n; } } $sqlquery = ; $sql = ; $db-Close(); ? -Original Message- From: Alex Gemmell [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 12, 2004 8:12 AM To: PHP List Subject: [PHP-DB] Linux/PHP/Access Database - oh boy :( Hello all, I am fairly new to Linux/PHP so please bear with me. I have an awfully awkward problem to solve - a stop gap solution for the next 6 months until we have out in-house servers set up and running. I also have a very short timeframe to sort this out. I am using PHP on a remotely hosted Linux web server to build my website, however I have been given a MS Access database to use! Despite my best efforts (and two days Google trawling) I haven't found a suitable solution so I am turning to your collective knowledge. First things first - I do not run the server and cannot install any new tools on to it (I cannot access the folders above my web root). There are lots of suggestions on the net about installing MDBTools and UnixODBC RPM (http://bryanmills.net:8086/archives/99.html) - but that involves the admin who won't do it! I can,
Re: [PHP-DB] Problem with PHP ODBC
If you are able to place the Access database on a Windows machine that can be accessed by the Linux machine, then you can use odbtp. You can get it at http://odbtp.sourceforge.net. -- bob On Wed, 5 May 2004 [EMAIL PROTECTED] wrote: Hi, I try to configure a web server under Debian/GNU/Linux Sarge. All fonctionning perfectly except odbc connect. I have to read datas in an ACCESS2000 mdb file to import in Mysql. Actually this run correct under a windows 2000 workstation with apache/PHP/Mysql I installed on my debian odbc tools and odbcinst. Under Linux i have an error in /var/log/apache/error.log Can't alloc filename Unable to locate database /var/www/foo.mdb I tried to relax permissions on my file foo.mdb (chmod 777) but i have the same error. Ideas ? Olivier FONTES Bad English speaking frenchie -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Problem with PHP ODBC
If you are able to place the Access database on a Windows machine that can be accessed by the Linux machine, then you can use odbtp. You can get it at http://odbtp.sourceforge.net. -- bob My problem is i can't modify my PHP code. Actually the web site runs on a windows2000 workstation and odbc work fine, y want to port this website with minimal modifications on a linux machine. I don't have time to code another system to import my access database. Then this may be difficult for you. Open source ODBC support for MS Access on Linux is only available with MDB Tools. Depending on what you are doing, it may not behave the same as the MS Access ODBC driver on Windows. If you were using a DB abstraction library like ADODb or PEAR DB, then porting would not be difficult. IF you cannot get MDB Tools to work, you may need to find a commercial MS Access ODBC driver that works on Linux. Take a look at http://bryanmills.net:8086/archives/99.html. It shows you how to configure MDB Tools and unixODBC to work with PHP. -- bob Olivier FONTES -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] DB and mssql
On Wed, 14 Apr 2004, Matt Matijevich wrote: [snip] [/snip] Thanks for the response. If I was hitting the memory limit, wouldn't php throw me some kind of error? Or would it just abort? It's normally the job of the extesion to report the error. But, I am not completely sure because I have never hit the limit. -- bob -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] DB and mssql
Hi Matt Before sending the result set, the mssql extension stores the entire result set into memory. However, PHP limits the amount of memory that can be allocated by a script to 8MB. So, the query will fail if the result set is larger than 8MB. You can change this value in php.ini with the memory_limit parameter. So, try increasing it and see if it solves the problem. -- bob On Tue, 13 Apr 2004, Matt Matijevich wrote: I am using PEAR::DB on linux, php 4.3.2, with freetds to access a sql server database. I am trying to get more information on the problem, but everyonece in a while, it seems random, php will stop executing when I use the query method, php stops executing. I dont get an error, php just stops running. I can echo out things before the query call but not after. The query that is running can return large result sets,on the high end it will return 1 - 15000 rows. I am am sql server novice so I am not sure where to start looking to see if the problem is db server side. I am just wondering if anyone has had this kind of problem before. I am not sure if it is something going on with PEAR::DB or if something is happening with the native php calls to sql server. I have not tried to do the query without using pear::db, but I am going to try that to see if I can get the script to error out that way. Thanks in advance. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] FYI: MS Access, MS SQL Server and UNICDOE text data
A question pertaining to this topic was posted in another forum. I have included the answer here for those who have to deal with this issue. Unlike MS SQL Server 7.0/2000, MS Access 2000 does not use separate types for non-UNICODE and UNICODE text data. Instead, ALL text data is stored as UNICODE. In other words, MS Access 2000 no longer has non-UNICODE text data types. The problem is that the MS Access ODBC driver externally indcates that they are non-UNICODE. And, the only way to submit queries containing UNICODE data is with the UNICODE version of the ODBC API. The only PHP solution that provides access to the UNICODE ODBC API is ODBTP. To process UNICODE data via PHP/odbtp you must do the following: 1. Include the following HTML meta tag within the HTML head section in EVERY PHP script and HTML file containing a form that calls a PHP script. meta http-equiv=Content-Type content=text/html; charset=utf-8 2. After connecting to the database with odbtp_connect(), enable UNICODE SQL support using odbtp_set_attr(): $con = odbtp_connect(...); odbtp_set_attr( ODB_ATTR_UNICODESQL, TRUE, $con ); 3. Rebind all fields bound as ODB_CHAR to ODB_WCHAR after running a query: $qry = odbtp_query( SELECT ... FROM ... ); $cols = odbtp_num_fields( $qry ); for( $col = 0; $col $cols; $col++ ) { if( odbtp_field_bindtype( $qry, $col ) == ODB_CHAR ) odbtp_bind_field( $qry, $col, ODB_WCHAR ); } Note: All UNICODE text data is read and sent by the ODBTP server using UTF-8 encoding and not UCS-2, including query text strings. Now that I am aware of what MS Access is doing, I will make this a little easier to do in the next version of ODBTP. BTW: Users of MS SQL Server do not have to rebind any fields. The SQL Server ODBC driver properly indicates which text fields are UNICODE. -- bob -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: Re: Re: SQL Server Query Failed
OK, let me know if you needed any assistance. BTW, are you using mssql_init() to call stored procedures? -- bob On Sat, 20 Mar 2004, david wrote: Bob: I shall experiment with option #3 (replacing php_mssql.dll with php_odbtp_mssql.dll). This will take a couple of days (I want to test it all out...sigh...testing...) and then slip it into production. I will report back on the results. On the Single Sign On... I am happy to talk about (and would LIKE to) but I don't know that this is the proper newsgroup for it? I am open for suggestions? I brought the SSO question up in comp.lang.php awhile ago, and although there was some discussion, mostly it petered out rather quickly. PHP for me was a requirement (part of the intranet is some PHP modules which are used on LAMP platforms); that is why we went PHP/Apache. (.NET was never in the picture, although in hindsight, I wish we had put up IIS/PHP.) However, it is a stable platform, and with just two exceptions (one being the above!) and the SSO issue that has recently surfaced, the platform has not experienced a single glitch. Personally, I do not favor the SSO solution, but I understand the business drive for it. Security and convenience are often strange bedfellows, and don't always get along. You are correct in the IIS supports SSO. david Robert Twitty [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi David Based on the amount of users accessing the site, there is a possibitity that php_mssql.dll not being thread safe could be the problem. The only way to verify this is to use PHP as a CGI, run Apache as a multi-process server, or replace php_mssql.dll with php_odbtp_mssql.dll. As much as I like PHP and dislike Microsoft, I personally would not have used Apache/PHP on a Win32 platform to connect to SQL Server. The proper choice should be IIS/ASP.NET. I believe that IIS supports the single sign-on feature for intranet purposes. You may have to decide which of the solutions I have mentioned is the most feasible. -- bob On Fri, 19 Mar 2004, david wrote: Thank you, Bob, for your continuing comments. The intranet site is used by approximately 100 people, and sees a good amount of traffic every day. I don't really have an exact number of daily queries that are executed, but it has to be a pretty sizable number, since the site handles much of the business issues. The query in question fails randomly (as far as I can tell: I have been watching for patterns for some time now.) If it always failed, that would really help. Sigh. Random. Naturally. Worse, the query is 100% dynamic, and built by the users (but of course they do not know they are building a query. They are just selecting things to report on, which is the way it should be, in my opinion). So, I don't have a query I can show as always fails, or sometimes fails. The only common thread in all of this is the tables in question. There are only a couple of tables, and they are used in the datawarehouse for reporting. Oddly, though (and I cannot prove this as much as I would like to) I think that some of the failures happen when no one else is using that table. All the other intranet tables perform as expected (and there are a LOT of those). I will look at the Apache 2/multi-process question. It is a great thought. I have another problem (this one is more of a how in the world do I do that, and relates to digging out the user signed onto the workstation for a single sign on solution: we won't go into the is that a good idea question, because it is moot, and I came out on the losing end); apparently I can't do this with Apache 2 and Windows, and so, long story short, perhaps I should consider other web server options. Thanks, Bob! david Robert Twitty [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi David Do these few queries ALWAYS fail, or just occasinally fail? Is this intranet site used by many people? If the same query always fails, you can determine if it may be a thread-safe issue by running that query outside of Apache as follows: c:\php\php thequery.php If the above fails, then it is probably not due to the fact that the mssql extension is not thread safe. If it does work then it could be the problem. I am not familiar with Apache 2.0, but I do believe it is a multi-threaded server, which is not good for extensions that are not thread-safe. If Apache 2.0 cannot be configured to run as a multi-process server, you should consider using Apache 1.3. -- bob On Fri, 19 Mar 2004, david wrote: Ahthread safe. THAT is an interesting thought. Especially because I somehow suspect that my problem is related to the database and/or table being locked just when I am trying to read
Re: [PHP-DB] Re: SQL Server Query Failed
Hi David Do these few queries ALWAYS fail, or just occasinally fail? Is this intranet site used by many people? If the same query always fails, you can determine if it may be a thread-safe issue by running that query outside of Apache as follows: c:\php\php thequery.php If the above fails, then it is probably not due to the fact that the mssql extension is not thread safe. If it does work then it could be the problem. I am not familiar with Apache 2.0, but I do believe it is a multi-threaded server, which is not good for extensions that are not thread-safe. If Apache 2.0 cannot be configured to run as a multi-process server, you should consider using Apache 1.3. -- bob On Fri, 19 Mar 2004, david wrote: Ahthread safe. THAT is an interesting thought. Especially because I somehow suspect that my problem is related to the database and/or table being locked just when I am trying to read it. However, I have to profess some ignorance about FastCGI. I looked at the web site for it, but I am not sure if by installing it I am now magically thread-safe? Or, once installed, do I need to make some code changes? My environment is an established intranet (Windows based; Windows 2000 server, Apache 2.0; connecting over the network to MS SQL Server, also running on Windows 2000). What is odd is that there are only a couple of queries that fail, and when they do, they ONLY fail against certain tables used for reporting from a data warehouse, and then only now and then (perhaps once a day; maybe less). The queries are dynamic in nature, and can pull data of integer, char, or varchar. All other queries (and there are a rather lot of them) for doing the mundane intranet stuff work perfectly, and have NEVER failed. It is a real puzzle. Thanks! david Frank M. Kromann [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi David, You problem might be a thread safty issue. the MSSQL extension is not thread safe (caused by the Microsoft Library used to create the extension). Use CGI or FastCGI to avoid this problem. - Frank P.S. I don't have the full thread of this discussion so I might miss some important information about your setup. Bruno: I did that. I had to wait a bit until it failed again, whcih it did a few moments ago. Alas, there is not one thing out of the ordinary in the log. Any other suggestions? THANK YOU! david Bruno Ferreira [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] david wrote: Hello there! I have just about driven myself crazy with an odd intermittent problem. [snip] I'd first start by turning on all logging I could in the SQL server so that I could see what's happening straight from the horse's mouth... Bruno Ferreira --- [This E-mail scanned for viruses by Declude Virus] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: Re: SQL Server Query Failed
Hi David Based on the amount of users accessing the site, there is a possibitity that php_mssql.dll not being thread safe could be the problem. The only way to verify this is to use PHP as a CGI, run Apache as a multi-process server, or replace php_mssql.dll with php_odbtp_mssql.dll. As much as I like PHP and dislike Microsoft, I personally would not have used Apache/PHP on a Win32 platform to connect to SQL Server. The proper choice should be IIS/ASP.NET. I believe that IIS supports the single sign-on feature for intranet purposes. You may have to decide which of the solutions I have mentioned is the most feasible. -- bob On Fri, 19 Mar 2004, david wrote: Thank you, Bob, for your continuing comments. The intranet site is used by approximately 100 people, and sees a good amount of traffic every day. I don't really have an exact number of daily queries that are executed, but it has to be a pretty sizable number, since the site handles much of the business issues. The query in question fails randomly (as far as I can tell: I have been watching for patterns for some time now.) If it always failed, that would really help. Sigh. Random. Naturally. Worse, the query is 100% dynamic, and built by the users (but of course they do not know they are building a query. They are just selecting things to report on, which is the way it should be, in my opinion). So, I don't have a query I can show as always fails, or sometimes fails. The only common thread in all of this is the tables in question. There are only a couple of tables, and they are used in the datawarehouse for reporting. Oddly, though (and I cannot prove this as much as I would like to) I think that some of the failures happen when no one else is using that table. All the other intranet tables perform as expected (and there are a LOT of those). I will look at the Apache 2/multi-process question. It is a great thought. I have another problem (this one is more of a how in the world do I do that, and relates to digging out the user signed onto the workstation for a single sign on solution: we won't go into the is that a good idea question, because it is moot, and I came out on the losing end); apparently I can't do this with Apache 2 and Windows, and so, long story short, perhaps I should consider other web server options. Thanks, Bob! david Robert Twitty [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi David Do these few queries ALWAYS fail, or just occasinally fail? Is this intranet site used by many people? If the same query always fails, you can determine if it may be a thread-safe issue by running that query outside of Apache as follows: c:\php\php thequery.php If the above fails, then it is probably not due to the fact that the mssql extension is not thread safe. If it does work then it could be the problem. I am not familiar with Apache 2.0, but I do believe it is a multi-threaded server, which is not good for extensions that are not thread-safe. If Apache 2.0 cannot be configured to run as a multi-process server, you should consider using Apache 1.3. -- bob On Fri, 19 Mar 2004, david wrote: Ahthread safe. THAT is an interesting thought. Especially because I somehow suspect that my problem is related to the database and/or table being locked just when I am trying to read it. However, I have to profess some ignorance about FastCGI. I looked at the web site for it, but I am not sure if by installing it I am now magically thread-safe? Or, once installed, do I need to make some code changes? My environment is an established intranet (Windows based; Windows 2000 server, Apache 2.0; connecting over the network to MS SQL Server, also running on Windows 2000). What is odd is that there are only a couple of queries that fail, and when they do, they ONLY fail against certain tables used for reporting from a data warehouse, and then only now and then (perhaps once a day; maybe less). The queries are dynamic in nature, and can pull data of integer, char, or varchar. All other queries (and there are a rather lot of them) for doing the mundane intranet stuff work perfectly, and have NEVER failed. It is a real puzzle. Thanks! david Frank M. Kromann [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi David, You problem might be a thread safty issue. the MSSQL extension is not thread safe (caused by the Microsoft Library used to create the extension). Use CGI or FastCGI to avoid this problem. - Frank P.S. I don't have the full thread of this discussion so I might miss some important information about your setup. Bruno: I did that. I had to wait a bit until it failed again, whcih it did a few moments ago. Alas, there is not one thing out of the ordinary in the log. Any other suggestions
Re: [PHP-DB] PHP - MSSQL - LINUX
You will need to install and configure the FreeTDS library. Another alternative is to use ODBTP, which is available at http://odbtp.sourceforge.net. It is much easier to install and configure than FreeTDS, and supports all of the mssql_* functions. However, ODBTP requires a WIn32 service to be installed on the machine running SQL server, or some other Win32 machine that can be accessed by the Linux machine. If this is not a problem, you will be able to get connected more quickly, and with additional capabilities. -- bob On Wed, 17 Mar 2004, Santhosh Kumar wrote: Hi All, Where do I get mssql.so to connect mssql with my PHP4.0.6 and PHP4.3.3 Regards, Santos Kumar.M -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] SQL Server Query Failed
What type of field is PhaseFK? -- bob On Wed, 17 Mar 2004, david wrote: Hello there! I have just about driven myself crazy with an odd intermittent problem. I have an intranet site, a good size one at that, on a Windows 2000 Server, running Apache, connecting to another Windows 2000 Server running SQL Server 2000. It all works just peachy, and life is good. But (there is always a but). Now and then, I get a Query Failed message. I cannot find the source of the problem, no matter how hard I try. I can't even find an error message, which is really odd. The query looks like this (it is a dynamic query, so it can change): SELECT PhaseFK FROM Facts WHERE (CategoryFK=5) The message I get back looks like this: Warning: mssql_query(): Query failed in runsql.php on line 10 I tried looking at the following to get an error message: mssql_query(SELECT @@ERROR as ErrorCode); (it returns nothing) mssql_get_last_message (it returns nothing, OR, sometimes it tells me that it changed the database context) What I think might be going on (because it ONLY happens with certain tables) is that the table is locked (there are some external processes that work with this table, which fire off more or less randomly from my code's point of view) or is other unavailable for some reason which eludes me. But I can't seem to figure out how to tell if this is the case or not. It seems to me that if I get a Query Failed then somewhere lurks an error code, and thus I can trap it nicely, instead of simply failing (that bugs me from a user point of view). Any thoughts? Thanks! david -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: SQL Server Query Failed
Hi David There does not appear to be any reason why you are having problems. Try using the odbtp/mssql hybrid extension at http://odbtp.sourceforge.net. It uses Microsoft's ODBC driver for SQL Server. The mssql extension on Windows uses DB-Library, which Microsoft stop supporting after SQL Server 6.5. If you use php_odbtp_mssql.dll instead of php_mssql.dll and read http://odbtp.sourceforge.net/phpext.html#mssql, you should not have to modify your script(s). -- bob On Wed, 17 Mar 2004, david wrote: Bob: Is this case, PhaseFK is an integer. However, it will fail on character fields as well. Thanks! david Robert Twitty [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] What type of field is PhaseFK? -- bob On Wed, 17 Mar 2004, david wrote: Hello there! I have just about driven myself crazy with an odd intermittent problem. I have an intranet site, a good size one at that, on a Windows 2000 Server, running Apache, connecting to another Windows 2000 Server running SQL Server 2000. It all works just peachy, and life is good. But (there is always a but). Now and then, I get a Query Failed message. I cannot find the source of the problem, no matter how hard I try. I can't even find an error message, which is really odd. The query looks like this (it is a dynamic query, so it can change): SELECT PhaseFK FROM Facts WHERE (CategoryFK=5) The message I get back looks like this: Warning: mssql_query(): Query failed in runsql.php on line 10 I tried looking at the following to get an error message: mssql_query(SELECT @@ERROR as ErrorCode); (it returns nothing) mssql_get_last_message (it returns nothing, OR, sometimes it tells me that it changed the database context) What I think might be going on (because it ONLY happens with certain tables) is that the table is locked (there are some external processes that work with this table, which fire off more or less randomly from my code's point of view) or is other unavailable for some reason which eludes me. But I can't seem to figure out how to tell if this is the case or not. It seems to me that if I get a Query Failed then somewhere lurks an error code, and thus I can trap it nicely, instead of simply failing (that bugs me from a user point of view). Any thoughts? Thanks! david -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] ODBC support
Hi Mark An alternative solution for connecting to MS Access is odbtp. Details are available at http://odbtp.sourceforge.net. It provides better support for ODBC, especially in regards to MS Access. Take a look at the storedqry.php example at http://odbtp.sourceforge.net/examples.html. It shows how to execute a MS Access stored query. The odbtp extension has a higher performance, and it allows you to remotely connect to your Access database from any platform. -- bob On Thu, 11 Mar 2004, Galbreath, Mark A wrote: Yes, I'm a newbie to PHP, but I got a phpBB2 BBS online in a day and I'm psyched. My problem is, the PHP docs and API mention that ODBC is built into PHP 4.x but I can't figure out how to use it. I would like to access the M$ Access JET engine directly from a PHP page. Any clues? tia, Mark -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Accessing MS SQL from Linux
Is the machine running SQL Server also hosted by the same company? Is it possible to use PHP on a Win32 machine so that you can use the php_mssql.dll extension? -- bob On Fri, 12 Mar 2004, S K Rana wrote: My domain is hosting through a hosting company on Linux with PHP 4.3.4. Hosting company is not open to re-compile PHP for using FreeTDS or any other application. If I can not use FreeTDS, what other options do I have? a) Can Pear be used? It is 4.3.4. I tried ?php required_once(DB.php) ? but got error. b) Can ADODB be used without re-compiling PHP? Any other option? Thanks -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP ODBC and Pervasive.SQL
Hi Pascal The odbc extension uses ODBC 2, while Access and Pervasive are most likely using ODBC 3. This may or may not be the cause of your problem. Try using the odbtp extension at http://odbtp.sourceforge.net. It uses ODBC 3, and may give you better results. -- bob On Wed, 25 Feb 2004, Pascal Schaedeli wrote: Hi, I am executing a SELECT query from PHP (4.3.4) through ODBC on a Pervasive 2000SP4 (all on Windows). odbc_result_all, odbc_fetch_into, and all other php odbc function stop returning records before the end of the effective resultset. Here is what is happening : * In Pervasive: SELECT * FROM table returns n records (correct). * In Access, throught ODBC, the same query returns the same n records (correct). * In PHP, odbc_exec of the same query returns mn records. Specifically, I have identifed one field (call it fieldx) that seems to be at the source of the problem : it seems stored over 4 bytes in Pervasive and represents a decimal number. If I rewrite the query in PHP to read SELECT fielda, fieldb,fieldc FROM table, it returns n records (correct) (just to clarify SELECT fielda, fieldb,fieldc,fieldx FROM table returns mn records). How many is m? It depends on the sort order. I have identified with record's fieldx is causing the problem. The records returned by odbc_* are up to that problem record. If the sort order makes that problem record to be the last one, then m = n-1. If the sort order makes that record be the first, then m = 0. Here is even more details for those who are still reading: fieldx is written to Pervasive from an application for which I do not have the source code. If I read the content of fieldx of the problem records, erase it and manually re-enter it (in Pervasive Control Center), the issue is solved and the PHP odbc query returns n records. I'm not an expert on odbc and pervasive. Intuitively, it seems that the field is somehow missformated. However, both Pervasive and Access are able to interpret it correctly. Does anybody have a suggestion on how I could either: - Get Pervasive to reformat all field correctly. - Get the odbc library in PHP to at least give me an error, or better, interpret the field as Access does. Thanks, Pascal -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] MS SQL 'Changed database context' error
Hi Michael Can I see the script you are using that causes the problem? When I change the database context using the mssql extension under PERA it is not a problem. The PEAR DB drivers suppress all messages generated by their underlying extensions. The mssql DB driver will only stop if the mssql ext function it calls fails. Since changing the database context should not cause a function to fail, I am not exactly sure why your script is stopping. -- bob On Sat, 21 Feb 2004, Michael Flanagan wrote: Thanks, Frank. Since I'm getting script stoppage as a result of this error (message), does that suggest that PEAR is mishandling the error/message? (I think PEAR loads and uses the standard mssql extension, but I'm not sure. Even if it does, I don't know if it inserts itself into the error handling stream.) You say that if a message has a severity higher than the setting in php.ini (mine is set to 10), then it will stop the script. Since the message I'm concerned with is a 0, then it should not stop the script. But, my script is stopping as a result of that message. So, is this a PEAR problem? If not, what am I doing wrong? If so, how can I get around this? Thanks! Michael -Original Message- From: Frank M. Kromann [mailto:[EMAIL PROTECTED] Sent: Saturday, February 21, 2004 7:40 PM To: Php-Db Subject: RE: [PHP-DB] MS SQL 'Changed database context' error The MSSQL standard mssql extension handles the 'Changed database context' message correct. Each query send to the SQL server results in some form of message returned. This can be either an error message or an information message. The MSSQL extension uses two ini settings to tell PHP how to handle these messages. If a message from the server has a severity equal to or higher than the setting in php.ini, PHP will create a warning or an error (stop processing the script). The default setting for both parameters is 10, and that should give a smooth execution of most PHP scripts. For debugging you might want to lover these values. (And this is not what I said in an earlier post but I was wrong then. This time I checked it :-)) 'Changed database context' has a severity = 0. This will only be handled by PHP if mssql.min_message_severity = 0. The mssql_get_last_message() function will always return the last message from the server. This function should not be used to check for errors. The function is intended to give the programmer a tool to fetch the message if an error is detected. - Frank Hi Robert, I've seen your name on a few of the ODBTP posts. You're one of the developers of same, yes? Are you familiar with the 'Changed database context' message? Do you know for sure that ODBTP handles that correctly? Thanks. Michael -Original Message- From: Robert Twitty [mailto:[EMAIL PROTECTED] Sent: Thursday, February 19, 2004 5:38 PM To: Michael Flanagan Cc: [EMAIL PROTECTED] Subject: RE: [PHP-DB] MS SQL 'Changed database context' error Hi Michael You might get better results using the odbtp extension with support for the mssql functions. Since you are using Windows, use php_odbtp_mssql.dll instead of php_mssql.dll. -- bob On Thu, 19 Feb 2004, Michael Flanagan wrote: Adam, Thanks for the suggestions. I don't want to ignore all error handling. Later, I might get an error that I really don't want php to swallow due to either of your suggestions. Has anyone else run into this and solved it? Any idea why the following lines in the php.ini file don't work? mssql.min_error_severity = 11 mssql.min_message_severity = 11 Michael -Original Message- From: Adam Voigt [mailto:[EMAIL PROTECTED] Sent: Thursday, February 19, 2004 12:44 PM To: Michael Flanagan Cc: [EMAIL PROTECTED] Subject: RE: [PHP-DB] MS SQL 'Changed database context' error Try putting the error suppressor (@) before the query, eg: @mssql_query Or, try setting the error reporting: error_reporting(0); On Thu, 2004-02-19 at 14:38, Michael Flanagan wrote: Thanks, Adam. I don't get the error in Enterprise manager. MS has a KB article out that says that this message is informational. I seem to remember that the article also says the message comes out some times, and not other times, but that you should just forget it. The particular SELECT statement I'm getting the message on is the second query in my script. The other query is to the same db; in fact, it uses the exact same $db connection object. Any ideas on getting PHP to ignore this info message? Thanks again. Michael -Original Message- From: Adam Voigt [mailto:[EMAIL PROTECTED] Sent: Thursday, February 19, 2004 12:13 PM To: Michael Flanagan Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] MS SQL 'Changed database context' error
Re: [PHP-DB] Connect to MSDE using PHP
Hi John I have never used MSDE, but from my understanding if is suppose to behave like SQL Server. When you installed it, did it mention anything about whether or not TCP/IP connectivity should be supported? You may need to ensure that the server is communicating over port 1433. If you are unsuccessful with either mssql or odbc, then you should try the odbtp extension at http://odbtp.sourceforge.net. If you use odbtp, use (local) for the SERVER parameter. -- bob On Sun, 22 Feb 2004, John W. Holmes wrote: I've downlownded and installed the Desktop Edition of MSSQL and am trying to connect to it with PHP. Has anyone ever accomplished this? I've uncommented the line in php.ini to load the MSSQL functions and they show up on a phpinfo() page, so that part is good. When I installed MSDE I tried it without a named instance first and just set an SA password. Neither of these worked: mssql_connect('localhost','sa','password') mssql_connect('coconut','sa','password') where coconut is the name of my computer. Then I tried installing MSDE again with a named instance and tried mssql_connect('namedinstance\localhost','sa','password') mssql_connect('namedinstance\coconut','sa','password') and those wouldn't work either. The only response I get is failed to connect to server ... I'm off to try ODBC. Anyone have any suggestions? -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] MS SQL 'Changed database context' error
Hi Michael Prior to executing a query with the PEAR mssql DB driver, the driver will always call mssql_select_db(). The db that was specified in the DSN is the one that is selected. If the db is changed after connecing via a query, i.e., use AnotherDB, this will cause a problem if the context is changed back to the original DB. Are you changing the DB after connecting? -- bob On Sun, 22 Feb 2004, Michael Flanagan wrote: Robert, Believe it or not, it's a simple SELECT statement! (I'm not even aware that I'm changing context, nor exactly what that means. I thought that if I used the same $db resource, things would be fine.) Other SELECTs work, but not this particular one! Here's the script (the FindInDb function below has, of course, been called from a prior script): /** * Find the record in the db that matches the Encounter info. * * If $updateObject is TRUE, then we update the object's fields with * values from the matching record in the database record. */ function FindInDb($db, $updateObject, $errStr) { global $DbOwner; // null string () for MS Sql Server if (!IsSet($this-_deviceId) || !(IsSet($this-_timeStart))) { $errStr .= Encounter::FindInDb: either _deviceId or _timeStart is NULL.; return FALSE; } $sql = SELECT * from {$DbOwner}Encounter . WHERE (Device_key = $this-_deviceId) AND . (Time_start = . ToDate($this-_timeStart, -MM-DD HH24:MI:SS) . ); if (!UseOrOpenDb($db, $closeDb, $errStr)) return FALSE; $result = GetInfoFromDbHelper($db, $sql, $errStr); and so on. The routine UseOrOpenDb looks at $db to see if it's a valid $db connection. If not, it opens a new one. I've determined that FindInDb is always passed a valid $db, so UseOrOpen doesn't open a fresh one. /** * Determine whether a db resource is already open; open one if not * * In many places we pass a $db resource to a routine. That resource might * not be open, in which case the called routine should open the db. */ function UseOrOpenDb($db, $dbOpened, $errorString) { if (!$db) { if (!($db = GetDbConnection ($errorString))) { return FALSE; } $dbOpened = TRUE; } else { $dbOpened = FALSE; } return TRUE; } GetInfoFromDbHelper simply executes the SQL string: function GetInfoFromDbHelper ($db, $select, $errorString) { // Get info, based on the $select query $result = $db-query($select); if (DB::isError($result)) { $errorString .= $result-getMessage() . $result-getDebugInfo (); return FALSE; } return $result; } -Original Message- From: Robert Twitty [mailto:[EMAIL PROTECTED] Sent: Sunday, February 22, 2004 2:49 PM To: Michael Flanagan Cc: Php-Db Subject: RE: [PHP-DB] MS SQL 'Changed database context' error Hi Michael Can I see the script you are using that causes the problem? When I change the database context using the mssql extension under PERA it is not a problem. The PEAR DB drivers suppress all messages generated by their underlying extensions. The mssql DB driver will only stop if the mssql ext function it calls fails. Since changing the database context should not cause a function to fail, I am not exactly sure why your script is stopping. -- bob On Sat, 21 Feb 2004, Michael Flanagan wrote: Thanks, Frank. Since I'm getting script stoppage as a result of this error (message), does that suggest that PEAR is mishandling the error/message? (I think PEAR loads and uses the standard mssql extension, but I'm not sure. Even if it does, I don't know if it inserts itself into the error handling stream.) You say that if a message has a severity higher than the setting in php.ini (mine is set to 10), then it will stop the script. Since the message I'm concerned with is a 0, then it should not stop the script. But, my script is stopping as a result of that message. So, is this a PEAR problem? If not, what am I doing wrong? If so, how can I get around this? Thanks! Michael -Original Message- From: Frank M. Kromann [mailto:[EMAIL PROTECTED] Sent: Saturday, February 21, 2004 7:40 PM To: Php-Db Subject: RE: [PHP-DB] MS SQL 'Changed database context' error The MSSQL standard mssql extension handles the 'Changed database context' message correct. Each query send to the SQL server results in some form of message returned. This can be either an error message or an information message. The MSSQL extension uses two ini settings to tell PHP how to handle these messages. If a message from the server has a severity equal to or higher than the setting in php.ini, PHP will create a warning or an error (stop processing the script). The default setting
RE: [PHP-DB] MS SQL 'Changed database context' error
Hi Michael You might get better results using the odbtp extension with support for the mssql functions. Since you are using Windows, use php_odbtp_mssql.dll instead of php_mssql.dll. -- bob On Thu, 19 Feb 2004, Michael Flanagan wrote: Adam, Thanks for the suggestions. I don't want to ignore all error handling. Later, I might get an error that I really don't want php to swallow due to either of your suggestions. Has anyone else run into this and solved it? Any idea why the following lines in the php.ini file don't work? mssql.min_error_severity = 11 mssql.min_message_severity = 11 Michael -Original Message- From: Adam Voigt [mailto:[EMAIL PROTECTED] Sent: Thursday, February 19, 2004 12:44 PM To: Michael Flanagan Cc: [EMAIL PROTECTED] Subject: RE: [PHP-DB] MS SQL 'Changed database context' error Try putting the error suppressor (@) before the query, eg: @mssql_query Or, try setting the error reporting: error_reporting(0); On Thu, 2004-02-19 at 14:38, Michael Flanagan wrote: Thanks, Adam. I don't get the error in Enterprise manager. MS has a KB article out that says that this message is informational. I seem to remember that the article also says the message comes out some times, and not other times, but that you should just forget it. The particular SELECT statement I'm getting the message on is the second query in my script. The other query is to the same db; in fact, it uses the exact same $db connection object. Any ideas on getting PHP to ignore this info message? Thanks again. Michael -Original Message- From: Adam Voigt [mailto:[EMAIL PROTECTED] Sent: Thursday, February 19, 2004 12:13 PM To: Michael Flanagan Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] MS SQL 'Changed database context' error This may not be the case, but I've seen this before when the PHP library didn't know how to express MS SQL's error, so it simply returns the last message sent which was the informational context change. If it is infact an error, you should be able to plug the query directly into Enterprise Manager to see MS SQL's take on the problem, so to speak. =) But again, this is all just in my past experience's, yours may differ greatly. On Thu, 2004-02-19 at 14:08, Michael Flanagan wrote: I'm getting the error Changed database context from MS SQL. I see where this is supposedly just an informational message. I've tried setting mssql.min_error_severity = 11 mssql.min_message_severity = 11 but to no avail. What am I missing? I don't mind the message so much, but php treats this as an error, and doesn't execute my query. I'm running php 4.3.3 for Windows; the SQL Server and web server are on the same machine. I'm using PEAR:DB for the database access. Thanks. Michael Flanagan voice: (1) 303-674-2691 fax: (1) 603-963-0704 (note '603' area code) mailto:[EMAIL PROTECTED] -- Adam Voigt [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Adam Voigt [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] MS SQL 'Changed database context' error
Hi Michael Yes, I am the developer of ODBTP, and changing the database context will not cause a problem. -- bob On Thu, 19 Feb 2004, Michael Flanagan wrote: Hi Robert, I've seen your name on a few of the ODBTP posts. You're one of the developers of same, yes? Are you familiar with the 'Changed database context' message? Do you know for sure that ODBTP handles that correctly? Thanks. Michael -Original Message- From: Robert Twitty [mailto:[EMAIL PROTECTED] Sent: Thursday, February 19, 2004 5:38 PM To: Michael Flanagan Cc: [EMAIL PROTECTED] Subject: RE: [PHP-DB] MS SQL 'Changed database context' error Hi Michael You might get better results using the odbtp extension with support for the mssql functions. Since you are using Windows, use php_odbtp_mssql.dll instead of php_mssql.dll. -- bob On Thu, 19 Feb 2004, Michael Flanagan wrote: Adam, Thanks for the suggestions. I don't want to ignore all error handling. Later, I might get an error that I really don't want php to swallow due to either of your suggestions. Has anyone else run into this and solved it? Any idea why the following lines in the php.ini file don't work? mssql.min_error_severity = 11 mssql.min_message_severity = 11 Michael -Original Message- From: Adam Voigt [mailto:[EMAIL PROTECTED] Sent: Thursday, February 19, 2004 12:44 PM To: Michael Flanagan Cc: [EMAIL PROTECTED] Subject: RE: [PHP-DB] MS SQL 'Changed database context' error Try putting the error suppressor (@) before the query, eg: @mssql_query Or, try setting the error reporting: error_reporting(0); On Thu, 2004-02-19 at 14:38, Michael Flanagan wrote: Thanks, Adam. I don't get the error in Enterprise manager. MS has a KB article out that says that this message is informational. I seem to remember that the article also says the message comes out some times, and not other times, but that you should just forget it. The particular SELECT statement I'm getting the message on is the second query in my script. The other query is to the same db; in fact, it uses the exact same $db connection object. Any ideas on getting PHP to ignore this info message? Thanks again. Michael -Original Message- From: Adam Voigt [mailto:[EMAIL PROTECTED] Sent: Thursday, February 19, 2004 12:13 PM To: Michael Flanagan Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] MS SQL 'Changed database context' error This may not be the case, but I've seen this before when the PHP library didn't know how to express MS SQL's error, so it simply returns the last message sent which was the informational context change. If it is infact an error, you should be able to plug the query directly into Enterprise Manager to see MS SQL's take on the problem, so to speak. =) But again, this is all just in my past experience's, yours may differ greatly. On Thu, 2004-02-19 at 14:08, Michael Flanagan wrote: I'm getting the error Changed database context from MS SQL. I see where this is supposedly just an informational message. I've tried setting mssql.min_error_severity = 11 mssql.min_message_severity = 11 but to no avail. What am I missing? I don't mind the message so much, but php treats this as an error, and doesn't execute my query. I'm running php 4.3.3 for Windows; the SQL Server and web server are on the same machine. I'm using PEAR:DB for the database access. Thanks. Michael Flanagan voice: (1) 303-674-2691 fax: (1) 603-963-0704 (note '603' area code) mailto:[EMAIL PROTECTED] -- Adam Voigt [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Adam Voigt [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Problem with ODBTP
Your query resource was detached from the connection. Can you supply the code prior to calling odbtp_fetch_row() and starting from odbtp_query()? -- bob On Tue, 17 Feb 2004, Sascha Kaufmann wrote: l Hello everyone I try to port an application from Windows/ODBC to Linux/ODBTP, I have a MSSQL Server 2000. If I use the function odbtp_fetch_row, I get the following warn message: Warning: [ODBTPERR][0]Detached object in file. Anyone a idea what this could mean? Google won't told me that :( best regards Sascha -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] ODBC with SQL Server
You cannot use the odbc mssql extensions to read nvarchar ntext fields. You will have to use the odbtp extension located at http://odbtp.sourceforge.net. It provides support for UNICODE data. -- bob On Fri, 13 Feb 2004, Juan Torres wrote: Hello, I have a connectoin ODBC with a SQL Server database. A table has a field of type 'nvarchar'. This field contains japanese characters. How can I read these japanese characteres? When I read (with: select name from data) only read '?' character. Thaks very much. Juan Torres. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] ODBTP 1.1 Released for MSSQL, Access, FoxPro ODBC
Hi Alain It is very safe. The ODBTP service has been running on a production machine that is also running SQL Server 2000. It has been running without failure since 12/15/2003, and has served over 1.5 million connections. A single ODBTP server is being used to connect to several MSSQL 6.5, MSSQL 7.0, MSSQL 2000, FoxPro and Access databases. Your admin can go to http://www.ushmm.org/wlc/en and http://www.ushmm.org/namesearch/ to view example sites that are using ODBTP. Both sites are hosted on a Solaris server running Apache/PHP, and communicate with a Win 2000 server running ODBTP SQL Server 2000. -- bob On Fri, 13 Feb 2004, Alain [iso-8859-15] Barthélemy wrote: Le jeudi 12 février 2004, 10:04:12 ou environ Robert Twitty [EMAIL PROTECTED] a écrit: Hi Alain Documentation is just to manage and understand odbtp_set_attr(...) and so on Documentation for all of the odbtp functions is available in odbtp source/docs. You can alos view it online at http://odbtp.sourceforge.net/phpext-index.html -- bob Hi Bob, Thank you for the Url of the ODBTP documentation. Now I can work usefully. I already transferred some FTP pages that were working without problems before on a Linux host with FreeTDS and suddenly stopped working without reason. Now it works! The only left problem is practical. I am working in a windows-addicted environment (sorry! Just a way of speaking) and I have to use my dual-boot PC to install ODBTP and my own old Toshiba PII labtop to install Apache/PHP/ODBTP client. And I would like to recover the Linux partition of my DeskTop PC. It is stupid to block a PC just to host ODBTP. One question: is it safe to install the ODBTP service on the MsSQL servor? It sounds logical for me but I have to convince the Admin to do it. Then the ODBTP and MsSQL servor addresses will be the same. Thanks, -- Alain Barthélemy [EMAIL PROTECTED] http://bartydeux.be Linux User #315631 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Japanese characters.
Use the odbtp extension. It provides the best, easiest and maybe only support for SQL Server's UNICODE data fields within PHP. -- bob On Fri, 13 Feb 2004, Juan Torres wrote: How can I read from a SQL Server DB, a field of type 'nvarchar'. This field contais japanese characters. thanks! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Paging large recordsets
Most of the PHP solutions I have seeen require the use of session variables. You could create an array containing only the unique identifiers of all the records, and then store it into a session variable. You would then use another session variable to retain the page size, and then include the page numbers in the Next, Prev, First, Last and Absolutr page links. Printing is probably best done with dynamically generated PDF instead of HTML. -- bob On Fri, 13 Feb 2004, Karen Resplendo wrote: I guess the time has come that my boss wants Next, Previous, First, Last paging for our data displays of large recordsets or datasets. Any good solutons out there already? I have pieces of a few examples. Also, how to deal with printing? I would assume that the ideal page size is not the ideal printed page size. oi vay! TIA - Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Paging large recordsets
If you are not opearating in a stateless environment, then you could use a cursor. The web is a stateless environment, and therefore the record set needs to be cached either to disk or memeory. The other alternative is to rerun the query for each page request. Using disk space to store query results for the purpose of paging over the web is commonly done by search engines, and even some database engines use disk space for cursor implementation. I agree that using session variables for this purpose is not ideal, but what's the alternative in PHP? Storing only the identifiers instead of all the data significantly lessons the impact. I agree, it should be avoided if possible. -- bob On Fri, 13 Feb 2004, Paul Miller wrote: In no way I am trying start some long thread here. But I have always heard it was bad to store that much data in a session array? I could just be really off here and not understanding what I have read. I know PHP stores the sessions as text files. The only reason I can come up with why one should not store large amounts of data would be disk write/read speed per user. Can someone clarify this for me? - Paul -Original Message- From: Robert Twitty [mailto:[EMAIL PROTECTED] Sent: Friday, February 13, 2004 12:34 PM To: Karen Resplendo Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Paging large recordsets Most of the PHP solutions I have seeen require the use of session variables. You could create an array containing only the unique identifiers of all the records, and then store it into a session variable. You would then use another session variable to retain the page size, and then include the page numbers in the Next, Prev, First, Last and Absolutr page links. Printing is probably best done with dynamically generated PDF instead of HTML. -- bob On Fri, 13 Feb 2004, Karen Resplendo wrote: I guess the time has come that my boss wants Next, Previous, First, Last paging for our data displays of large recordsets or datasets. Any good solutons out there already? I have pieces of a few examples. Also, how to deal with printing? I would assume that the ideal page size is not the ideal printed page size. oi vay! TIA - Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Run SQL-Server command using PHP
For MSSQL databases use the following syntax for executing a stored procedure: mssql_query( EXEC sp_name param1, param2, param3, ... ); Another alternative is to use the mssql_init(), mssql_bind() mssql_execute() functions. Also, better support for executing MS-SQL stored procedures is available in the odbtp extension at http://odbtp.sourceforge.net. For example, take a look at http://odbtp.sourceforge.net/insertints_php.html. -- bob On Thu, 12 Feb 2004, Ricardo Lopes wrote: You can use something like: SELECT MyFunction(); Thinks works on mySQL, i'm not sure if it works on mssql but you can give it a try. Tanks to Alban Médici (NetCentrex) who told me this a month ago on this list :) - Original Message - From: indra Siregar [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, February 12, 2004 12:47 AM Subject: [PHP-DB] Run SQL-Server command using PHP How I can run sql-server using PHP, like sp (stored procedure) in SQL-Server ThankYou -- Indra Siregar IF02008 Politeknik Informatika Del -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Connecting, and interacting with Lotus Notes databases...
ODBC is the only way that I am aware of for connecting to a Lotus Notes database via PHP. -- bob On Wed, 11 Feb 2004 [EMAIL PROTECTED] wrote: I did a search on Google, and turned up a few links, but they all seemed to be on about mail databases... however, I need to talk to other databases... I'm hoping that it'll be as easy as it is to talk to MySQL... anyone got any experience in that? Tris... * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. *** -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Compatibility between Sybase and PHP
Unless I am mistaken, but isn't it possible to build the sybases extension using the Sybase client library and not FreeTDS? -- bob On Wed, 11 Feb 2004, Alan Chan wrote: Hi, I found that there is a problem in the version compatibility between our Sybase server and PHP/apache server. PHP can retrieve data from Sybase but get core dump when exit from sybase call. This seems to happen in several version of freetds and php. Has anyone encountered such problem before and found out a solution to it? Any help will be very much appreciated. -- Have a nice day! Regards, Alan Chan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Connecting, and interacting with Lotus Notes databases...
If you are going to use a Notes database over the web, the easiest way to do this is with the Lomino Web Servwer. -- bob On Wed, 11 Feb 2004 [EMAIL PROTECTED] wrote: Sadly, no... I'm totaly new to Notes, and all I know is... 1. There is a databse, that stores our events 2. I need to add/delete/edit etc these events via our web site (run with PHP) I take it I should totter off, and find out exactly how the database is structured first? I don't know squat about notes... Am I gonna get over my head very quickly? J. Kevin C. Burton [EMAIL PROTECTED] 11/02/2004 14:09 To [EMAIL PROTECTED] cc Subject RE: [PHP-DB] Connecting, and interacting with Lotus Notes databases... Can you be more specific about your question, If you want to talk to multiple database with minimal changes, use Adodb or I am using php 5 - DBX functions for ODBC and MySQL. Kevin -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 11, 2004 8:58 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Connecting, and interacting with Lotus Notes databases... I did a search on Google, and turned up a few links, but they all seemed to be on about mail databases... however, I need to talk to other databases... I'm hoping that it'll be as easy as it is to talk to MySQL... anyone got any experience in that? Tris... * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. *** -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. *** -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Windows XP and PHP
A better solution for connecting to SQL Server is the php_odbtp_mssql.dll extension available at http://odbtp.sourceforge.net. The reason why is because the php_mssql.dll was built using DB-Library, which is obsolete and unsupported by Microsoft. This is why ntwdblib.dll is not in MDAC, and contains bugs that will never be fixed. The php_odbtp_mssql.dll file supports all of the functions from the php_mssql.dll file. And, unlike the php_mssql.dll, it supports all of the new data types available in SQL Server 2000, such as, varchar(255), nvarchar and ntext. -- bob On Sun, 8 Feb 2004, Duane Lakoduk wrote: I had this bookmarked too, and I had forgotten about it. Would installing the MDAC Microsoft have on their site install the ntwdblib.dll? Don't think so, I have current MDAC installed and it is not on my ws. I just found this on: http://www.php.net/function.mssql-connect GET ntwdblib.dll This dll can also be found in the binary zip of php 4.3 in the dlls subdir. put it in the system32 dir. WATCH OUT... i used a copy found on a MSSQL server, used that.. couldn't get it to work.. My function calls seamed OK, could call the mssql routines but I got a connection error When I used the dll distributed with the binary zip of php 4.3 it worked. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Acessing a excel worksheet from a php site
You can use ODBTP (http://odbtp.sourceforge.net) to connect to it using MS's ODBC driver for Excel. -- bob On Fri, 6 Feb 2004, Griffiths, Daniel wrote: I dont know any way to actually open and read the file with php, havent come across any classes or methods that will do this. My solution when I had this problem was to do it in 2 parts, run a macro on the excel file that will extract the data to a text file and then use php to read that into the db. if there is a way to open excel files and read them with php i'd love to know about it. -Original Message- From: Bruno Pereira [mailto:[EMAIL PROTECTED] Sent: 06 February 2004 03:36 To: [EMAIL PROTECTED] Subject: [PHP-DB] Acessing a excel worksheet from a php site I'm making a site to a company and they have a excel worksheet where i have to get the data to a site in php. My question is simple, i think, how can i get it? Cumprimentos Bruno Pereira DSI [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] ODBTP 1.1 Released for MSSQL, Access, FoxPro ODBC
ODBTP version 1.1 has been released is available at http://odbtp.sourceforge.net Many new functions and enhancements have been added to the odbtp extension. The changes make it the best PHP solutiion for connecting to MSSQL, Access, FoxPro and other Win32 ODBC accessible databases from any platform. Its native connection pool eliminates the need for persistent connectinns. All of the functions from the mssql extension are optionally supported. This means that existing PHP scripts that use the mssql extension would not have to modified to use ODBTP. The odbtp/mssql hybrid extension's performance and capabilities exceed both the FreeTDS (UNIX / Linux) and DB-Library (Win32) versions of the mssql extension. ODBTP uses Microsoft's ODBC driver for SQL Server, which is superior to FreeTDS and DB-Library when connecting to SQL Server 2000 databases. And, unlike the mssql extension, the odbtp/mssql extensinn's behaviour is exactly the same on all platforms. While the functions from the odbc extension are not supported, the odbtp extension provides better support for ODBC. Most of the odbc extension's limitations are caused by its use of ODVC 2 instead of ODBC 3, which is used by ODBTP. The odbtp extension is also considerably faster. Rather than further elaborating on why odbtp is the best sulution, which is obviously biased, the best thing is for users of the mssql and / or odbc extensions to try the odbtp extension. Not until then will they be able to determine whether or not the aforementioned is correct. And, to make it easy to try odbtp, a PEAR DB driver is included in the package. -- bob -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MS SQL date time strangeness
Oops Use Off instead of On, or execute this in your script: ini_set('mssql.datetimeconvert' , 0 ); Note: Do not use the date() function to display the value. Just display it asis. -- bob On Tue, 27 Jan 2004, Steve wrote: I tried what you had suggested and I still get the same result. Robert Twitty wrote: The date() is for use with the 32-bit C time value returned by functions like time(). Data from fields of type datetime are returned as strings in the form Jan 9 2004 by the mssql extension as the default. To return it using ISO format set mssql.datetimeconvert to On in the php.ini file, or use the following command: ini_set('mssql.datetimeconvert' , 1 ); -- bob On Mon, 26 Jan 2004, Steve wrote: I have Apache 1.3 and PHP 4 running on Windows 98 connecting to a local MS SQL 7.0 server. MS SQL has the date as 2004-01-09 (-MM-DD), when I print the date to a webpage with this PHP code: printf(Date Picked Up: %s\nDate, date(Y/j/n,$row[0]); I get this output: 1969/12/31 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MS SQL date time strangeness
The date() is for use with the 32-bit C time value returned by functions like time(). Data from fields of type datetime are returned as strings in the form Jan 9 2004 by the mssql extension as the default. To return it using ISO format set mssql.datetimeconvert to On in the php.ini file, or use the following command: ini_set('mssql.datetimeconvert' , 1 ); -- bob On Mon, 26 Jan 2004, Steve wrote: I have Apache 1.3 and PHP 4 running on Windows 98 connecting to a local MS SQL 7.0 server. MS SQL has the date as 2004-01-09 (-MM-DD), when I print the date to a webpage with this PHP code: printf(Date Picked Up: %s\nDate, date(Y/j/n,$row[0]); I get this output: 1969/12/31 What is wrong? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: PHP - MsSQL - DB error connect failed - mssql_pconnect?
mssql_pconnect() may add to problem of too many connections. The reason is because the persistent connection is associated with the Apache child process and not the script. This is significant because you are not guaranteed to be served by the same child everytime the script is invoked. Thus, over an extendend period of operation, the result will be a persistently open connection for each active Apache child process. -- bob t On Wed, 21 Jan 2004, Alain [iso-8859-15] Barthélemy wrote: Le mercredi 21 janvier 2004, 13:55:26 ou environ Alain Barthélemy [EMAIL PROTECTED] a écrit: Still another question in my (desperate?) trials to connect to a MsSQL-2000 Server from a Linux host. I don't work usually with MsSQL but no choice at work. Still problems to have a connections. I went to see the SQL-server administrator and she found that the same person had 4 connections to the server (and not having 4 jobs at the same time). The server is quickly saturated (undersized) and I suppose that the mssql_connect() request of my PHP script is just ignored because there is no place left (bad configuration of the MsSQL server?). Now I wonder if it would be possible to keep a stable connection with mssql_pconnect()? Can anybody enlighten me? -- Alain Barthélemy [EMAIL PROTECTED] http://bartydeux.be Linux User #315631 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MSSQL stability problem
Maybe you are running out of connections. -- bob On Wed, 21 Jan 2004, Stuart wrote: I have a site that makes heavy use of a local SQL Server database. Every 6-12 hours the site continuously reports not being able to connect to the database. That is the only info in the warning that's given. The only solution I've found is to restart the Apache and MSSQL services. The [MSSQL] section from my php.ini is appended below. IIRC the only values I've changed are mssql.textlimit and mssql.textsize. Has anyone seen this before? What causes it and how can I stop it happening short of restarting the services every 6 hours? Thanks. -- Stuart [MSSQL] ; Allow or prevent persistent links. mssql.allow_persistent = On ; Maximum number of persistent links. -1 means no limit. mssql.max_persistent = -1 ; Maximum number of links (persistent+non persistent). -1 means no limit. mssql.max_links = -1 ; Minimum error severity to display. mssql.min_error_severity = 10 ; Minimum message severity to display. mssql.min_message_severity = 10 ; Compatability mode with old versions of PHP 3.0. mssql.compatability_mode = Off ; Connect timeout ;mssql.connect_timeout = 5 ; Query timeout ;mssql.timeout = 60 ; Valid range 0 - 2147483647. Default = 4096. mssql.textlimit = 2147483647 ; Valid range 0 - 2147483647. Default = 4096. mssql.textsize = 2147483647 ; Limits the number of records in each batch. 0 = all records in one batch. ;mssql.batchsize = 0 ; Specify how datetime and datetim4 columns are returned ; On = Returns data converted to SQL server settings ; Off = Returns values as -MM-DD hh:mm:ss ;mssql.datetimeconvert = On ; Use NT authentication when connecting to the server mssql.secure_connection = Off ; Specify max number of processes. Default = 25 ;mssql.max_procs = 25 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Truncated fields
You may need to set mssql.textlimit to a value greater than the default of 4096 characters. -- bob On Wed, 21 Jan 2004, Michael Lewis wrote: John, I'm getting much more than 255 characters. The field is not varchar but a text field. I've looked into FREETDS as the most likely source of the problem but haven't found anything yet. Michael Michael Lewis wrote: I'm having a problem with retrieving field data from SQL SERVER 2000 and am not sure where the problem lies. I have a variable length field (from 100 - 1 characters). When I retrieve the field using a select statement, then into a PHP variable such as $text=$r['body_text'], then the field seems to be truncated after a good bit of it has been returned (at least 1000 characters). I am using PHP 4.3.4 and FREETDS 0.62 on a Red Hat 9.0 system to access SQL Server. The question is, is there a returned field size maximum defaulting or defined in SQL Server, PHP, or FREETDS and/or has anyone else had this problem? Not sure where the problem is exactly (I think it's FREETDS), but you can only use 255 characters in a variable character column. Newer versions of FREETDS may solve this, otherwise change your column type. -- ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] stored procedures on mssql
Use mssql_bind -- bob On Mon, 5 Jan 2004, Filipe Girafa wrote: Hi, how do i pass the arguments to the db when using the mssql_execute function? thanks, Filipe -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] MS Access, FoxPro and PHP
Is anyone using MS Access, FoxPro or any other file-based database via ODBC with PHP? -- bob -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Access db
To the best of my knowledge you cannot access an Access database directly from UNIX or Linux. The reason is because the Jet Engine has not been ported to those platforms. Your only options may be something like EasySoft's ODBC-ODBC bridge or ODBTP. -- bob On Wed, 19 Nov 2003, Luke van Blerk wrote: Hi everyone Can PHP access an access database residing on a unix / linux box? I know theres and ODBC extension but is that only for windows? Regards Luke -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] ODBTP - ODBC - FOXPRO.
Setting SourceDB=c:\telefonia\; instead of SourceDB=c:\telefonia\CDTCTL01.DBF; solved the problem. -- bob Warning: [S1000][1][Microsoft][ODBC Visual FoxPro Driver]Fox Error 1 [IM006][0][Microsoft][Administrador de controladores ODBC] Error de SQLSetConnectAttr del controlador in /var/www/telefonia/registro/prueba_odbtp.php on line 2 ? $link = odbtp_connect('172.16.4.106','Driver={Microsoft Visual FoxPro Driver};SourceDB=c:\telefonia\CDTCTL01.DBF;SourceType=DBF'); ? thanks for the help, and thanks for the program is a great software, i hope i can make it work with FoxPro :) c'ya! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] ODBC
Take a look at ODBTP, which is located at http://odbtp.sourceforge.net. ODBTP allows you to remotely connect to Win32-based ODBC from any machine, including Linux/UNIX. -- bob On Wed, 15 Oct 2003, Ricardo C. Fernandez de C. wrote: Hi, The sad part is that there is 0 documentation about how to connect to remote ODBC DSN, or a detailed structure of how to connect to it besides the odbc_connect(dsn,user,password), DSN could be string that tells the function where is the dsn, what database, what driver... but is not documented. I guess i will just read the file with the dbase funtions and convert it to psql, its not going to be real time, but oh well, thanks for the help. On Wed, 2003-10-15 at 04:07, Michael.J.Bourke wrote: I think you will have to create a DSN on each machine you use to serve PHP pages. Otherwise, you might want to look into using DSN-less connections instead. -Original Message- From: Ricardo C. Fernandez de C. [mailto:[EMAIL PROTECTED] Sent: 14 October 2003 16:22 To: php-db Subject: RE: [PHP-DB] ODBC Ok, it worked on the local machine if i do odbc_connect(telefonia,,) But, if i'm on the remote machine, i have a problem, the DSN will not query a Database at all, it will query 3 Fox Pro Tables, what query should i use then? any idea? thanks for the help :) On Tue, 2003-10-14 at 10:21, Michael.J.Bourke wrote: odbc_connect requires three parameters: you have specified just one. PHP takes the string between the pairs of double-quotes to be just one parameter. You will also need to specify a username and password for access to the DB. Assuming you have none, try this: $conn=odbc_connect(Driver={Microsoft Fox Pro Driver};Server= 127.0.0.1;Database=telefonia,,); -Original Message- From: Ricardo C. Fernandez de C. [mailto:[EMAIL PROTECTED] Sent: 14 October 2003 15:16 To: [EMAIL PROTECTED] Subject: [PHP-DB] ODBC Hi all, I have been trying to connect to a windows ODBC controller with PHP, and after reading some of the documentation, I can't make the connection This is the Code I'm using: ? $conn=odbc_connect(Driver={Microsoft Fox Pro Driver};Server= 127.0.0.1;Database=telefonia,,); if(!$conn) { echo Not connected; } ? And i get this Warning Message: Warning: Wrong Parameter count for odbc_connect in c:\apache2\htdocs\od_connect.php on line 2 And of course the Not Connected echo message. Any idea why is this? any good document I can read about PHP-ODBC (ODBC in Windows) besides the official Documentation? any other idea? Thanks, c'ya -- Ricardo C. Fernández de C. Fundabit - Min. de Educación, Cultura y Deporte. Caracas/Venezuela -- Ricardo C. Fernández de C. Fundabit - Min. de Educación, Cultura y Deporte. Caracas/Venezuela -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Ricardo C. Fernández de C. Fundabit - Min. de Educación, Cultura y Deporte. Caracas/Venezuela -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] ODBC to MSSQL on FreeBSD for PHP
You should use the mssql extension for this purpose. Another alternative is odbtp. -- bob On Thu, 9 Oct 2003, rick rice wrote: What do I need and where can I get it? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: PHP connection to remote Access database on NT
You cannot use FreeTDS to connect to an Access database. You also cannot use odbc on Linux either. The only way to connect to an Access database from Linux is with something like EasySoft's ODBC-ODBC bridge or ODBTP. -- bob On Thu, 11 Sep 2003, nabil wrote: Yes , and I done myself to mssql on windows from linux/apache you have to use odbc .. use FreeTDS , it is free and open soured... and work like a charm Nabil John Almberg [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Here's a question I hoped I'd never have to ask... Is it possible for PHP, running on a Linux/Apache webserver, to connect to an Access database running on a remote NT box? The NT box is a back office server behind a firewall. In a nutshell, the customer wants his website to be able to record on-line sales in his Access-based Point of Sale system. The POS system will be running simultaneously. I haven't done much work with Access, but my impression is that it locks tables and there might be some difficulties sharing write access to the data, but I could be wrong about this. Is there any way Access can be stretched to do this kind of thing? Thanks. -- John -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MSSQL2000 and PHP
Yes You cannot read varchar(255) data fields. You cannot easily read ntext and nvarchar (UNICODE) fields. No direct support for stored procedures. -- bob On Mon, 1 Sep 2003, Arnaud L wrote: Hi, We have migrate our SQL server to MSSQL2000. Since this migration, we can't connect to MSSQL using PHP (on linux with SybaseCT librairie) Any Issues ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Query runs fine on Console but not in PHP
First FreeTDS should have built support for TDS protocol version 8.0. The tds protocol version should also be set to 8.0 in interface file. Details about this is included with the FreeTDS source distribution. -- bob On Mon, 18 Aug 2003, vish.kohli wrote: Thanks for your response. My script is running on Linux. I am trying to retrieve simple data such as text and numbers. I am not sure what the TDS protocol setting should be. What are the typical settings and how can I check it? Would appreciate any tips for debugging. Thanks. - Original Message - From: Robert Twitty [EMAIL PROTECTED] To: vish.kohli [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, August 18, 2003 8:28 AM Subject: Re: [PHP-DB] Query runs fine on Console but not in PHP What platform are you using? Since it appears that the script is crashing, you are probably on Linux or some other UNIX flavor. If this is the case, the TDS protocol setting may not be correct. What type of date are you retrieving with this stored procedure? -- bob On Sun, 17 Aug 2003, vish.kohli wrote: Hi, I am trying to execute a stored procedure in PHP via mssql_query () function. I pass 8 parameters to it. The query runs fine in SQL Query Analyzer but when I run it thru PHP, it behaves strangely. I can get number of rows (mssql_num_rows()) and number of fields (mssql_num_fields()) in PHP, but when I try to execute mssql_fetch_object() or mssql_fetch_array() on the same result identifier, I get a Page could not be displayed (standard internet error page). Please help. Thanks in advance. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Mcrosoft SQL Server and for xml auto queries
The win32 version of the mssql extension does not support the FOR XML clause because it sends the results using ntext, which is the new UNICODE text type introduced in SQL Server 7.0. The mssql extension was built with DB-Library, which cannot read ntext fields. DB-Library is obsolete, and Microsoft has no desire to enhance or fix it. -- bob On Mon, 18 Aug 2003, Daniel Cher wrote: I've been trying for months to figure out how to get for xml auto queries to work from PHP. I've got it working from ASP, which I strongly disprefer (hate!). I'd simply like to do: $sql = select * from customers for xml auto; $xml = $mssql-execute($sql); echo $xml This should return: root customer id=1 name=Alfred Futt/ customer id=2 etc./ /root Any help appreciated. Daniel -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Query runs fine on Console but not in PHP
What platform are you using? Since it appears that the script is crashing, you are probably on Linux or some other UNIX flavor. If this is the case, the TDS protocol setting may not be correct. What type of date are you retrieving with this stored procedure? -- bob On Sun, 17 Aug 2003, vish.kohli wrote: Hi, I am trying to execute a stored procedure in PHP via mssql_query () function. I pass 8 parameters to it. The query runs fine in SQL Query Analyzer but when I run it thru PHP, it behaves strangely. I can get number of rows (mssql_num_rows()) and number of fields (mssql_num_fields()) in PHP, but when I try to execute mssql_fetch_object() or mssql_fetch_array() on the same result identifier, I get a Page could not be displayed (standard internet error page). Please help. Thanks in advance. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: PHP MSSQL
I believe this is only applicable to fields of type text. It may have no effect on varchar(255) fields. The purpose of this statement is to limit the amount of memory allocated by the driver for text data. If it is not specified, the driver will try to allocate 2GB of memory. The extension sets this value to 4096 by default. -- bob On Mon, 11 Aug 2003 [EMAIL PROTECTED] wrote: personally, i had luck with the statement below, but have sent it to others in the past and they had varying results. but give this a shot at the top of your page that your PHP code is running on. mssql_query(set textsize 65536); hth Jeff Adam Presley [EMAIL PROTECTED]To: [EMAIL PROTECTED] m cc: Subject: [PHP-DB] Re: PHP MSSQL 08/11/2003 10:26 AM I know what you're going through here. In MS SQL you can define a VARCHAR up to about 8000 characters, but your PHP mssql_query command only returns 255 (0 - 254) characters. I then tried using the TEXT datatype. TEXT datatype in MS SQL allows somewhere around 2 billion characters. However, the PHP mssql_query command only returns 4096 characters every time. This appear to be a limitation of the PHP MSSQL commands. Shaun Bentley [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi I am currently trying to use PHP and MSSQL together but I am having a few problems. I can enter data into the Db OK, but when pulling the data back to display on the page, the string cuts to around 250 chars. The Db field is VarChar 6000 and I can see the whole data in the field. I have tried pulling the data out as object, array row but always lose the end. Any help please! Shaun -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] ODBC Database
Unless I am mistaken, but isn't there an ODBC driver available for MySQL called MyODBC? -- bob On Sun, 10 Aug 2003, Gerard Samuel wrote: Larry E.Ullman wrote: Im looking at venturing into working with PHP's ODBC extention. Does anyone have any recommendations as to a Database, that is easy to understand/get into from a novice point of view, that installs on windows 2k, and is free? MySQL is kind of free, installs on W2K and is easy to use but it doesn't require PHP's ODBC extension since PHP already has a good MySQL extension. If you really want to use ODBC and you have MS Office, you could try Access. What Im doing is seeing if my code will run on different databases. Of which it currently runs on mySQL, PostgreSQL and MSSQL. As soon as I can get PHP5 installed Ill be checking out SQLLite. But in the meantime, Im looking for a database that would interface with ODBC. I just downloaded IBM's DB2 Personal Edition, to see what I can do there, but, Im just looking for advice etc from others who went down this road. Thanks -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP MSSQL
This is true if Shaun was using MySQL, but he is using MSSQL. MSSQL allowas you to declare char and varchar fields with lengths up to 8000 characters. Unfortunately the extension bundled with PHP cannot read beyond the first 255 characters. This is primarily due to the fact that the extension was built using DB-LIB, which does not adequately support all of the new data types introduced in MSSQL 7.0 and 2000. -- bob On Mon, 11 Aug 2003, Matthew McNicol wrote: Shaun, the MySQL manual suggests that you have hit your limit using the VARCHAR field type (255 characters). To store 6,000 characters have you not considered using the TEXT field type? 6.2.3.1 The CHAR and VARCHAR Types The CHAR and VARCHAR types are similar, but differ in the way they are stored and retrieved. The length of a CHAR column is fixed to the length that you declare when you create the table. The length can be any value between 1 and 255. (As of MySQL Version 3.23, the length of CHAR may be 0 to 255.) When CHAR values are stored, they are right-padded with spaces to the specified length. When CHAR values are retrieved, trailing spaces are removed. Values in VARCHAR columns are variable-length strings. You can declare a VARCHAR column to be any length between 1 and 255, just as for CHAR columns. However, in contrast to CHAR, VARCHAR values are stored using only as many characters as are needed, plus one byte to record the length. Values are not padded; instead, trailing spaces are removed when values are stored. (This space removal differs from the SQL-99 specification.) No case conversion takes place during storage or retrieval. If you assign a value to a CHAR or VARCHAR column that exceeds the column's maximum length, the value is truncated to fit. - Original Message - From: Shaun Bentley [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, August 11, 2003 11:23 AM Subject: [PHP-DB] PHP MSSQL Hi I am currently trying to use PHP and MSSQL together but I am having a few problems. I can enter data into the Db OK, but when pulling the data back to display on the page, the string cuts to around 250 chars. The Db field is VarChar 6000 and I can see the whole data in the field. I have tried pulling the data out as object, array row but always lose the end. Any help please! Shaun -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.506 / Virus Database: 303 - Release Date: 01/08/2003 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Access 95 ODBC Annoyance
If the other application opens the database exclusively, then you will not be able to open it, even for read only. The only solution to modify the sharing option used by the other application. Another problem you may encounter is that the ODBC driver for Access is not thread safe. -- bob On Thu, 17 Jul 2003, J. Michael Roberts wrote: I'll be the first to admit this is a rather backwards system and prone to be illogical, but it's what was handed to me and I can't do much about that. I've got an ancient Access 95 database that I've linked to via another A95 database which is queried via ODBC. It was done this way because I'm not allowed to touch the first database due to the insane way they replace the data each week. (i.e.: any of my tables would be gone, so I need to keep 'my' data safe and link to 'their' data) While under development, I was working with a copy of the database and got everything to work fine. In order to go live with the current data, I had to go into 'my' database and update the linked tables. When this was done, my interface failed miserably and returned the following message: Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] The Microsoft Jet database engine cannot open the file 'T:\TS\Te_rdata.mdb'. It is already opened exclusively by another user, or you need permission to view its data., SQL state S1000 in SQLExecDirect in C:\Apache2\htdocs\projecthours\deptjobs.php on line 44 Now it gets worse: I need to be able to access the data even if someone has it open. Read-only access isn't a problem...because that's all this particular interface does...but I just keep getting denied. Any ideas? Suffering under a backwards system, --JMR PS - Access is a hunk of crap...especially Access 95. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP/ODBC/Apache/Netware/Foxpro Problem
What is the setting of the ODBC connect string parameter SOURCEDB? Does the PC running Apache have permission to access the path specified by SOURCEDB? -- bob On Mon, 14 Jul 2003, YT Lee wrote: I have a Windows XP PC configured as follow: 1. Apache 2.0.46 2. PHP 4.3.2 3. Microsoft Visual Foxpro ODBC Driver The PC is connected to a Netware 3.2 server. The database are implemented as Foxpro 2.6 free tables on the Netware server. The PC is connected to the server via Netware client version 4.83 SP1E. Using WinSQL Lite, I can access the Foxpro tables on the Netware server from the PC through ODBC. Using PHP command line mode, I can also execute the following PHP script on the PC without problems: --- fp.php --- ?php $link = odbc_connect ('foxtest', '', '', 0) or die (Could not connect); print (Connected successfully to foxtest); $result = odbc_exec($link, SELECT * FROM SVCCAR); if (!$result) { echo odbc_error(); exit; } odbc_close ($link); ? -- fp.php However, when I try to run the same script from Apache using a browser, an error occurs and the output is as follow: --- output --- Connected successfully to foxtest Warning: SQL error: [Microsoft][ODBC Visual FoxPro Driver]File 'svccar.dbf' does not exist., SQL state S0002 in SQLExecDirect in C:\htdocs\php\FP.PHP on line 9 S0002 output --- It appears that PHP is able to connect to the ODBC but it is not able to see any tables on the Netware disk. If I move the Foxpro files to the PC's hard disk, the script runs fine. Any assistance is highly appreciated. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] how to update field without using UPDATE query? youare kidding?
In order o update fields without using a UPDATE statement you have to use a cursor. In general, this is how ADO (the technology used by ASP) performs its updates in the manner you outlined below. There are no extensions bundled with PHP of which I am aware that allow you to update data via a cursor. -- bob On Mon, 9 Jun 2003, Steve B. wrote: Hi in asp it lets me say ~get a record into dbrec which is a database object. dbrec['field1'] = 'wow' dbrec.update; is there no way to do this in linux? thats lame if it is then that means my 25 web sites have to be re-written to work on Linux. --- Becoming Digital [EMAIL PROTECTED] wrote: I assume you lack update permissions, which means you probably don't have the other permissions necessary to change data. Assuming you actually do, you could use REPLACE or DELETE followed by INSERT. Edward Dudlik Becoming Digital www.becomingdigital.com - Original Message - From: Steve B. [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, 09 June, 2003 19:29 Subject: [PHP-DB] how to update field without using UPDATE query? how to update field without using UPDATE query? I open the db at a certain ID then set $dbrec['field'] = new value How do you update the db? Thanks -steve - Do you Yahoo!? Free online calendar with sync to Outlook(TM). -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Do you Yahoo!? Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Query takes to much time
What database are you using? Also, are all the fields involved in the joins and whare clause properly indexed? Depending on the database you are using, it is possible to determine if the indexed fields are being used. -- bob On Tue, 3 Jun 2003, André Sannerholt wrote: Hi everybody, now I have the following qery that still needs to much time: select distinct Anschriften.ID as aid, Anschriften.PLZ as aplz, Anschriften.STRASSE as astrasse, Anschriften.HNR as ahnr from Anschriften inner join Master on Anschriften.ID=Master.A inner join Master as m on Master.FN=m.FN inner join Personen on m.NN=Personen.ID where Personen.ID = $id It gives me the correct results I hope you can help me to get it faster! André -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: ODBTP, a possible solution for MS-SQL and other databases
Thanks for the tip. I will take this issue to the PHP-DEV list. -- bob - Original Message - From: l0t3k [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, November 02, 2002 2:31 AM Subject: [PHP-DB] Re: ODBTP, a possible solution for MS-SQL and other databases Robert, this seems like an excellent idea. you should present in PHP-DEV, though, since this NG is primarily for userland PHP users, not low-level PHP developers. l0t3k -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] ODBTP, a possible solution for MS-SQL and other databases
Hello I have been using PHP for about 9 months, and have chosen it as my primary scripting language for web applications. I have and still use ASP and JSP. IMHO, PHP is superior and easier to use than those languages except in one area that is important to me, which is the ability to access MS SQL Server 7.0 / 2000 databases from a UNIX box. Out of the box PHP provides great support for MySQL and PostgreSQL, and at this time I have no desire to use them because I do not believe that they are ready for prime time. The open source solution that is always recommended for UNIX-based PHP / MS-SQL connectivity is freeTDS, and unfortunately I found it to be quite lacking in its capabilities and useless in certain situations. Another alternative was to use a commercial ODBC driver management system on UNIX. Sadly, it was not in the budget for this endeavor, and the PHP odbc extensions could use some work in terms of ease of use. Because I was determined to use PHP (I really dislike using JSP / JDBC on UNIX, and IIS / ASP is out of the question), I decided to create my own solution. Since I have a substantial amount of experience in programming directly with the Win32 ODBC API and TCP/IP, I decided to create a service that runs on a Win32 platform that can communicate with any platform via TCP/IP. The service uses a home grown protocol that allows a client to access any database that the service can see via the ODBC drivers that are installed on the computer which it resides. In other words, it allows a PHP client on UNIX to access a database using the ODBC drivers installed on a Windows NT / 2000 server. It is nothing more than a middle man service for Win32 ODBC. The name of the service is called ODBTP (Open Database Transport Protocol), and no there is not a RFC for this protocol. Thus far, I have successfully accessed MS-SQL, Oracle and Sybase databases via ODBTP. ODBTP consists of a Windows NT / 2000 service application, an ODBTP client library that can be used to create Win32 or UNIX clients, and a PHP extension module that was created with the library. ODBTP has the following features: * Multi-client servicing * True connection pooling (not persistent connections) * Client reserved connections (virtual connections for stateless web clients) * Supports all data types, including nvarchar, ntext, varchar(255), char(255), datetime, and bigint. * No big-endian / little-endian problems. * Server-side data binding. * Stored procedure execution, parameter passing (including NULL's) and output retrieval. * Transactions, i.e., supports commits and rollbacks under any transaction isolation level. * UNICODE data is processed using UTF-8 encoding (important since PHP strings are not UNICODE) * Can retrieve query results sent in XML format. * Verbose error reporting, all ODBC error messages are sent to client. * No discovered memory leaks or buffer overflow possibilities. * Designed to be as easy as possible to use with PHP I am new to this mailing list, and it appears that PHP is predominantly used for MySQL and PostgreSQL, and thus I am not sure if ODBTP is of any interest to most people on this list. My original intent was not to release ODBTP to the public (I really don't have the time to maintain freeware), but if there is a substantial interest I will release it to the public. I am curious to see how well it performs in other environments. -- bob The following is a table, stored procedures and a php script that uses ODBTP to initialize the table with data. CREATE TABLE dbo.Employees ( Id int IDENTITY (1, 1) NOT NULL , ExtId numeric (15,0) NOT NULL , LastName varchar (50) NOT NULL , FirstName varchar (50) NOT NULL , Title varchar (256) NOT NULL , Salary money NOT NULL , JobDesc varchar (3000) NULL , Notes ntext NULL , Active bit NOT NULL , DateEntered datetime NOT NULL , DateModified datetime NOT NULL , CONSTRAINT PKCL_Employees_Id PRIMARY KEY CLUSTERED ( Id ) ) CREATE PROCEDURE AddEmployee ExtId numeric(15,0), LastName varchar(50), FirstName varchar(50), Title varchar(256), Salary money, JobDesc varchar(3000) = 'Job not defined' AS SET NOCOUNT ON INSERT INTO Employees( ExtId, LastName, FirstName, Title, Salary, JobDesc ) VALUES( ExtId, LastName, FirstName, Title, Salary, JobDesc ) IF ERROR 0 RETURN 0 RETURN IDENTITY GO CREATE PROCEDURE SetEmployeeNotes Id int, Notes ntext AS SET NOCOUNT ON UPDATE Employees SET Notes = Notes, DateModified = getdate() WHERE Id = Id GO ?php if( !extension_loaded('odbtp') ) dl('odbtp.so'); $con = odbtp_connect( 'odbtpsvr.somewhere.com', 'DRIVER={SQL Server};SERVER=sqlsvr.somewhere.com;UID=myuid;PWD=mypwd;DATABASE=OdbtpTest;' ) or die; odbtp_set_attr( ODB_ATTR_TRANSACTIONS, ODB_TXN_READCOMMITTED ) or die; $qry1 = odbtp_query( TRUNCATE TABLE
[PHP-DB] Fw: Dows anyone know why this was bounced?
Does anyone know why all mail that I send to any aspect of the php-db list is bounced when it is sent from the address below? -- bob - Original Message - From: Robert Twitty [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, October 31, 2002 9:39 PM Subject: Returned mail: see transcript for details (fwd) -- Forwarded message -- Date: Thu, 31 Oct 2002 19:45:12 -0500 (EST) From: Mail Delivery Subsystem [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Returned mail: see transcript for details The original message was received at Thu, 31 Oct 2002 19:45:12 -0500 (EST) from neutron.ushmm.org [207.77.113.18] - The following addresses had permanent fatal errors - [EMAIL PROTECTED] (reason: 553 This entry was last confirmed open on 2/16/2002) - Transcript of session follows - ... while talking to pair1.php.net.: RCPT To:[EMAIL PROTECTED] 553 This entry was last confirmed open on 2/16/2002 550 5.1.1 [EMAIL PROTECTED]... User unknown ---BeginMessage--- ---End Message--- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php