can create tables, can't select, insert or update

Dave Brotherstone davegb at pobox.com
Sat Apr 6 12:41:53 EST 2002


Do a "select user_name()", to see what user it thinks you are.  The "select
permission denied" message has come straight back from the server, so it's
definately the server end.
Try granting the permissions to that user (returned from user_name())
explicitly - you'll probably find it's just a permissions problem.

Dave.

> -----Original Message-----
> From: bounce-freetds-139968 at franklin.oit.unc.edu
> [mailto:bounce-freetds-139968 at franklin.oit.unc.edu]On Behalf Of
> julian at zol.co.zw
> Sent: 05 April 2002 23:12
> To: TDS Development Group
> Subject: [freetds] can create tables, can't select, insert or update
>
>
> I have finally got php-4.1.2 to talk to mssql2k on win2k through
> apache 1.3.22 using freetds-0.53 -- thanks for that.
>
> I can make a table, but I can't select, insert or update. I get
> "SELECT permission denied on object 'test', database 'Julian',
> owner 'julian'" etc.
> I do have these permissions on the server.
>
> Here's the php:
>
> mssql_connect($hostname,$username,$password);
> mssql_select_db($dbName);
>
> // this does work:
> $create_query = "create table test (
>           UserID int NULL ,
>           username  varchar (20) NULL ,
>           password varchar (20) NULL ,
>           )";
>
> // this does not work:
> $insert_query = "Insert into test (UserID, username, password)
> VALUES (123, 'ADMIN', 'thispassword')";
>
> // this does not work:
> $select_query = "select UserID from test";
>
> $result = MSSQL_QUERY($select_query);
>
> $number = MSSQL_NUM_ROWS($result);
>
> $i=0;
>
> if ($number == 0) :
>         print "No data?";
> elseif ($number > 0) :
>         print "Data:";
>         while ($i < $number) :
>                 $username = mssql_result($result,$i,"username");
>                 print $username;
>                 print "";
>                 $i++;
>         endwhile;
> endif;
>
> -- any ideas where Ive gone wrong?
>
> TDSDUMP and tcpdump on port 1433 record nothing when I do one of
> the failed queries, but I do get records of any CREATE TABLE query.
>
>
>
>
> ---
> You are currently subscribed to freetds as: [davegb at pobox.com]
> To unsubscribe, forward this message to
> $subst('Email.Unsub')
>
>




More information about the FreeTDS mailing list