0

Is it possible to create a read-only connection using PDO dblib, or set an attribute with a similar effect?

$connection = new PDO("dblib:host={$info['host']};dbname={$info['database']}", $info['username'], $info['password']);
$connection->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
return $connection;

If not, is there some other PDO driver that would be able to do this that can connect to FreeTDS?

Dale K
  • 25,246
  • 15
  • 42
  • 71
mbomb007
  • 3,788
  • 3
  • 39
  • 68
  • 1
    In your database create a user account with select privileges only. –  Jul 08 '19 at 22:13

1 Answers1

2

The best solution here is to create account on the db server with readonly permissions, and connect using that.

Mike Foxtech
  • 1,633
  • 1
  • 6
  • 7