freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: Robert Gonzalez <robert AT robert-gonzalez.com>
- To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
- Subject: Re: [freetds] freetds and php configiration
- Date: Thu, 5 Nov 2009 10:43:45 -0800
Can you post your connection code and the code that executes this query? It
looks like you are trying to pass a database object to the second param of
mssql_init(), which requires the connection link identifier.
On Thu, Nov 5, 2009 at 3:27 AM, Tareq <tarek.atallah AT tahadi.com> wrote:
> Hi their
> It seem its working but I have error connecting to the following error
> Changed database context to
>
>
> [root@localhost html]# php Test.php
> 23<br>25<br>27<br>
> Warning: mssql_init() expects parameter 2 to be resource, object given in
> /var/www/html/Test.php on line 28
> 29<br>
> Warning: mssql_bind() expects parameter 1 to be resource, null given in
> /var/www/html/Test.php on line 32
> 33<br>
> Warning: mssql_bind() expects parameter 1 to be resource, null given in
> /var/www/html/Test.php on line 34
> 35<br>
> Warning: mssql_execute() expects parameter 1 to be resource, null given in
> /var/www/html/Test.php on line 36
> 37<br>Changed database context to 'REF_SYSTEM'.40<br>
> Warning: mssql_fetch_assoc() expects parameter 1 to be resource, null given
> in /var/www/html/Test.php on line 41
>
>
>
> Anyhelp please with Changed database context to ?
>
>
>
>
>
> Tarek Atallah
> Senior Database Administrator
> Tahadi Games - www.tahadi.com
> Mobile +962 776555508
> E-mail W : tarek.atallah AT tahadi.com
> E-mail P : tarek.atallah AT gmail.com
>
> -----Original Message-----
> From: freetds-bounces AT lists.ibiblio.org
> [mailto:freetds-bounces AT lists.ibiblio.org] On Behalf Of Robert Gonzalez
> Sent: Monday, October 26, 2009 6:18 PM
> To: per AT bends.se; FreeTDS Development Group
> Subject: Re: [freetds] freetds and php configiration
>
> The following are two write-ups I did on getting PHP to talk to MS SQL
> servers from Fedora and from Ubuntu. Both of these use the native MS SQL
> extension for PHP (which in my opinion is way better than using ODBC). Keep
> in mind these instructions assume you have control over your own server and
> that you have some experience building software, specifically PHP
> extensions, from source.
>
>
> http://www.robert-gonzalez.com/2009/02/18/building-the-php-ms-sql-server-ext
> ension-from-source-on-ubuntu-810/
> <
> http://www.robert-gonzalez.com/2009/02/18/building-the-php-ms-sql-server-ex
> tension-from-source-on-ubuntu-810/>
>
> http://www.robert-gonzalez.com/2008/03/31/connecting-php-on-linux-to-mssql-o
> n-windows/
>
> On Mon, Oct 26, 2009 at 7:41 AM, Per Stenebo <per AT bends.se> wrote:
>
> > It would be nice to be able to use mssql extension with php and freetds
> but
> > I have not yet figured out how.
> > In my very limited knowledge I can use only ODBC extension.
> > /Per Stenebo
> >
> > 2009/10/26 Tareq <tarek.atallah AT tahadi.com>
> >
> > > I was wondering cant we use mssql php extension to do so ?
> > >
> > >
> > >
> > >
> > > Tarek Atallah
> > > Senior Database Administrator
> > > Tahadi Games - www.tahadi.com
> > > Mobile +962 776555508
> > > E-mail W : tarek.atallah AT tahadi.com
> > > E-mail P : tarek.atallah AT gmail.com
> > >
> > >
> > > -----Original Message-----
> > > From: freetds-bounces AT lists.ibiblio.org
> > > [mailto:freetds-bounces AT lists.ibiblio.org] On Behalf Of Per Stenebo
> > > Sent: Monday, October 26, 2009 2:01 PM
> > > To: FreeTDS Development Group
> > > Subject: Re: [freetds] freetds and php configiration
> > >
> > > This is a test script I've been using to connect to a MS SQLserver 2005
> > > thru
> > > PHP and FreeTDS:
> > > It simply connects and list user tables in the DB.
> > >
> > > <html>
> > > <body>
> > >
> > > <?php
> > > $db = "mydatabase";
> > >
> > > $con = odbc_connect("databaseserver", "domain\\username", "password");
> > > if (!$con)
> > > {
> > > print("There is a problem with SQL Server connection.\n");
> > > }
> > > else
> > > {
> > > print("The SQL Server connection object is ready.\n");
> > >
> > > // List user tables in database
> > > echo "<h4>Tables in database $db</h4>";
> > > $sql = "select name from $db..sysobjects where xtype = 'U'";
> > > $result = odbc_exec($con, $sql) or die(odbc_errormsg($con));
> > > while (odbc_fetch_row($result))
> > > {
> > > print("<p>" . odbc_result($result,1) . "</p>\n");
> > > }
> > >
> > > odbc_free_result($result);
> > > odbc_close($con);
> > > }
> > > ?>
> > >
> > >
> > > </body>
> > > </html>
> > >
> > > I think the keywords to use in searching for help are "php ODBC".
> > > Hope it helps.
> > > /Per Stenebo
> > >
> > >
> > > 2009/10/26 Tareq <tarek.atallah AT tahadi.com>
> > >
> > > > Hi all ,
> > > >
> > > > I have installed freetds and php, now how I can configure php to use
> > > tds?
> > > >
> > > > Any help please?
> > > >
> > > >
> > > >
> > > >
> > > > Tarek Atallah
> > > > Senior Database Administrator
> > > > Tahadi Games - www.tahadi.com
> > > > Mobile +962 776555508
> > > > E-mail W : tarek.atallah AT tahadi.com
> > > > E-mail P : tarek.atallah AT gmail.com
> > > >
> > > >
> > > > -----Original Message-----
> > > > From: freetds-bounces AT lists.ibiblio.org
> > > > [mailto:freetds-bounces AT lists.ibiblio.org] On Behalf Of Frediano
> > Ziglio
> > > > Sent: Sunday, October 25, 2009 10:41 AM
> > > > To: ikorot AT earthlink.net; FreeTDS Development Group
> > > > Subject: Re: [freetds] Is MS SQL Server closes cursor on every
> > > > commit/rollback?
> > > >
> > > > This is a server setting. Do you really need to use this option?
> > > >
> > > > freddy77
> > > >
> > > > Il giorno 25/ott/2009, alle ore 09.08, ikorot AT earthlink.net ha
> > scritto:
> > > >
> > > > > Hi, ALL,
> > > > > I am trying to develop a program that will
> > > > > use an ODBC connection to different DB.
> > > > > It will be based on some other C++ library.
> > > > >
> > > > > What I found is that the comment to the ODBC interface
> > > > > for this library says following:
> > > > >
> > > > > // By default, MS Sql Server closes cursors on commit and rollback.
> > > > > The following
> > > > > // call to SQLSetConnectOption() is needed to force SQL Server to
> > > > > preserve cursors
> > > > > // after a transaction. This is a driver specific option and is
> not
> > > > > part of the
> > > > > // ODBC standard. Note: this behavior is specific to the ODBC
> > > > > interface to SQL Server.
> > > > > // The database settings don't have any effect one way or the
> other.
> > > > > const long SQL_PRESERVE_CURSORS = 1204L;
> > > > > const long SQL_PC_ON = 1L;
> > > > > /* retcode = */ SQLSetConnectOption(hdbc, SQL_PRESERVE_CURSORS,
> > > > > SQL_PC_ON);
> > > > >
> > > > > Is this true for all version of MS SQL Server or just for an old
> > ones?
> > > > > Is it the same for Sybase as well?
> > > > >
> > > > > What I will gain/lose when this will be disabled?
> > > > >
> > > > > Thank you.
> > > > >
> > > > > _______________________________________________
> > > > > FreeTDS mailing list
> > > > > FreeTDS AT lists.ibiblio.org
> > > > > http://lists.ibiblio.org/mailman/listinfo/freetds
> > > > _______________________________________________
> > > > FreeTDS mailing list
> > > > FreeTDS AT lists.ibiblio.org
> > > > http://lists.ibiblio.org/mailman/listinfo/freetds
> > > >
> > > > _______________________________________________
> > > > FreeTDS mailing list
> > > > FreeTDS AT lists.ibiblio.org
> > > > http://lists.ibiblio.org/mailman/listinfo/freetds
> > > >
> > >
> > >
> > >
> > > --
> > > MVH Per Stenebo
> > > Ballingslöv
> > > 0708-78 18 24
> > > _______________________________________________
> > > FreeTDS mailing list
> > > FreeTDS AT lists.ibiblio.org
> > > http://lists.ibiblio.org/mailman/listinfo/freetds
> > >
> > > _______________________________________________
> > > FreeTDS mailing list
> > > FreeTDS AT lists.ibiblio.org
> > > http://lists.ibiblio.org/mailman/listinfo/freetds
> > >
> >
> >
> >
> > --
> > MVH Per Stenebo
> > Ballingslöv
> > 0708-78 18 24
> > _______________________________________________
> > FreeTDS mailing list
> > FreeTDS AT lists.ibiblio.org
> > http://lists.ibiblio.org/mailman/listinfo/freetds
> >
>
>
>
> --
>
> Robert Gonzalez
> http://www.robert-gonzalez.com
> _______________________________________________
> FreeTDS mailing list
> FreeTDS AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds
>
> _______________________________________________
> FreeTDS mailing list
> FreeTDS AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds
>
--
Robert Gonzalez
http://www.robert-gonzalez.com
-
Re: [freetds] freetds and php configiration,
Tareq, 11/05/2009
- Re: [freetds] freetds and php configiration, Robert Gonzalez, 11/05/2009
Archive powered by MHonArc 2.6.24.