Hi

The server on which I have a site crashed and the guy who takes care of that stuff seems to have put sqlite on the new server :

PDO support enabled
PDO drivers sqlite, sqlite2

which throws up a "could not find driver" error when i try to connect using the existing connection class:

/*** mysql hostname ***/
$hostname = 'localhost';

/*** mysql username ***/
$username = 'xxxxxx';

/*** mysql password ***/
$password = 'xxxxxxx';


try {
    $conn = new PDO("mysql:host=$hostname;dbname=xxxxxx", $username, $password);

	// force connection encoding to uft8
	$conn->exec('SET CHARACTER SET utf8');

/*** echo a message saying we have connected ***/
echo('Connected to database');

}
catch(PDOException $e)
    {
    echo($e->getMessage());
    }

so I guess I need to change something here

any ideas how I can do this ?

thanks

    Get the guy to install the same version of MySQL as before 🙂

    Basically, you can fix this problem by using the correct SQLite DSN, but if your script uses MySQL specific stuff, then this is not good enough.

      laserlight;10950582 wrote:

      Get the guy to install the same version of MySQL as before 🙂

      lol - I wish I could - that would make life a LOT easier

      laserlight;10950582 wrote:

      Basically, you can fix this problem by using the correct SQLite DSN, but if your script uses MySQL specific stuff, then this is not good enough.

      ok - I'll have a read of that

      however, I looked at thePDO section of the phpinfo() output and it seems that only the drivers for sqlite and sqlite2 have been enabled - so I've sent the Guy an email (if he bothers reading it) to see if he can enable the driver for mysql - maybe that'll fix the probs

      thanks for your help

        Yes.
        pdo_mysql is not enabled.

        It should look like this in phpinfo();

        PDO support enabled
        PDO drivers	mysql, sqlite, sqlite2 
          Write a Reply...