Skip to Content.
Sympa Menu

freetds - Re: [freetds] Help accessing sql 2005

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Thomas, Christopher (LLU)" <cwthomas AT llu.edu>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Help accessing sql 2005
  • Date: Mon, 12 Jan 2009 08:48:21 -0800

Hello,

I'm guessing you are using PEAR DB. Please look at this page to see the
options you can pass when calling the connect() method:

http://pear.php.net/manual/en/package.database.db.db-common.setoption.ph
p

As you can see 'AutoCommit' is not one of them. I use PEAR DB a lot
except with the mssql protocol instead of odbc, and it has been my
experience that AutoCommit is set to true by default. If for some reason
it is not, look at this page to change it:

http://pear.php.net/manual/en/package.database.db.db-common.autocommit.p
hp

Using ODBC, you should have no problems accessing a SQL Server 2005 box
from PHP as long as you can run your queries from the command line using
isql.

Chris

> -----Original Message-----
> From: freetds-bounces AT lists.ibiblio.org [mailto:freetds-
> bounces AT lists.ibiblio.org] On Behalf Of Bill Kruchas
> Sent: Monday, January 12, 2009 6:49 AM
> To: mailing list freetds
> Subject: [freetds] Help accessing sql 2005
>
> Hello
>
> I have just installed freetds and have gotten it to work (somewhat).
>
> to test I selected a record set from northwind on sql 2005 and it
worked
> fine.
>
> Next I tried to select a record set from a different database and
table,
>
> then I got a message about setting autocommit.
>
> so now I set autocommit like this
>
> $dsn = array(
> 'phptype' => "odbc",
> 'hostspec' => "sqlserver-ontime",
> 'username' => "user",
> 'password' => "pw"
> );
> $db_attrs = array (
> 'AutoCommit' => true
> );
> print( $_POST['us_name'] . ' ' . $_POST['us_pw']);
> $db = DB::connect($dsn, $db_attrs);
> $db->setFetchMode(DB_FETCHMODE_ASSOC);
> $sql = "SELECT userid,loginid,fullname,disable FROM
timetrakusers
> where loginid = '" .$_POST['us_name']. "' and password = '"
> .$_POST['us_pw']. "';";
> $result = $db->query($sql);
>
>
> But I get an error:
>
> An error occurred while trying to run your query.
> Error message: DB Error: unknown option AutoCommit
> Details: [DB Error: unknown error]
>
>
> First why does Northwind work without autocommit,
> is it because the "recovery method is simple" (no transaction log)?
>
> Second could someone point me to, or share an example of reading and
> writing to a mssql 2005?
>
> Thanks In advance
>
> Bill Kruchas
> _______________________________________________
> FreeTDS mailing list
> FreeTDS AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds




Archive powered by MHonArc 2.6.24.

Top of Page