Testing database connection

I'm trying to create a startup document for my colleagues who want to know more about Yii. Let's say I have the default installation, and have configured the app with a database connection to MySQL.

I have the default layout and theme already.

Is there a way, from this point, to test the database connection using the already available functions?

Thanks.

The quickest and the most reliable way to test your DB connection is to embed the following code in your default view (not recommended in working code though):



<?php 


Yii::app()->db->active=true;


$row=Yii::app()->db->createCommand('SELECT * FROM SomeTable')->query();


print_r($row);


?>


Not meaning to compare but would it be possible to have some sort of feature to have a default view for testing responses from databases, or any function without having to create a view for it? I think Cake has this.

But thanks for the speedy response. I’ll create a default view for it so I can test my other functions. :)

Not for now, but we are developing such a tool.

That'd be great! Thanks!