This may seem like a stupid question, but rest assured that I don't need general database help, but MS Access help specifically. This would not be a problem if I were working with any other database.
I need to fish out the primary key(s) form an MS Access table using PHP with an ODBC connection. I have found two PHP functions that supposedly can accomplish this, but I'm confused over what the parameters are supposed to be, since the documentation is lacking in detail.
NOTE: The point is to get the names (and preferably types) of the primary keys of the table. If this can be achieved without the qualifier and owner, the problem is solved.
This is the most promising function:
resource odbc_primarykeys ( resource $connection_id , string $qualifier , string $owner , string $table )
Documentation: http://www.php.net/manual/en/function.odbc-primarykeys.php
And here is the other:
resource odbc_specialcolumns ( resource $connection_id , int $type , string $qualifier , string $owner , string $table , int $scope , int $nullable )
Documentation: http://www开发者_StackOverflow社区.php.net/manual/en/function.odbc-specialcolumns.php
The only parameters I'm having trouble identifying are "qualifier" and "owner".
It's my understanding that "qualifier" means "database name" in normal geek speak and that "owner" means, well, the owner of the database (or table). My problem is that I am not aware of there actually being an "owner" to the database, and I can't for the life of me figure out what the database's name should be in a programmatic context. As far as I can tell, it's just a file that you open by double-clicking, at which point I duly see tables, columns, rows, primary keys and all the other objects that one would expect in a database but alas, no database name indicated, anywhere.
This is particularly frustrating because I don't need to know either the "qualifier" nor owner to connect to, SELECT, INSERT, UPDATE and DELETE from the database. ;)
Is there a query, or a place in MS Access 2007 where I can find:
a) the "owner",
b) the "qualifier" (or "database name")
Thanks in advance!
The owner of all objects (tables, etc.) in MS Access is by default the "Admin" account, which has no password.
You can find that by looking here:
- Tools->Security-User and Group Permissions
- Tools->Security-User and Group Accounts
I'll hazard a guess that the qualifier isn't really important. The examples I've seen with MS SQL seem to use the database name (of which there could be many on a MS SQL server). I suggest trying it with "" or null in the qualifier field, and "Admin" for the owner (you might be able to get ways with "" or null too).
精彩评论