为什么PDO在没有dbname的情况下工作?

I am connecting to my database using this command:

$resource = new PDO('odbc:driver=FreeTDS;Server=127.0.0.1;Port=8090;UID=Reporting;PWD=readonly;');

There is no dbname specified, and yet, it still connects to a database. The problem is, it is connecting to the wrong database. I tried including a section dbname=DATABASENAME;, but this was entirely ignored. How do I tell PDO to connect to a different database?

Use DATABASE instead of DBNAME, i think this is the problem:

$resource = new PDO('odbc:driver=FreeTDS;Server=127.0.0.1;Port=8090;DATABASE=DATABASENAME;UID=Reporting;PWD=readonly;');

did you try to do the Standard operation? like....

new PDO("odbc:Driver={SQL Server};Server=127.0.0.1;Database=test;",'sa','password'); 

and which database you are using? ms sql server or some else?