2

I work on a app which has only one way to get a working DB connection: a function that returns a MySQL connection resource.

Is there any way for me to convert that MySQL connection to a PDO MySQL connection?

I don't have access to the MySQL server in any other way, no username, password, nothing. I can't see/get the file with the function in it, either. I might be able to, later, but still, I'd like to know if it is possible.

1 Answer 1

5

No - that's impossible. PDO and the ext/mysql are two completely different components to access a MySQL server.

Without username, password, host (can be retrieved by using string mysql_get_host_info ([ resource $link_identifier ] ) and database name (can be retrieved by looking at a list of databases on the server with resource mysql_list_dbs ([ resource $link_identifier ] )), you won't be able to connect to the server with any other method than the given one. It's impossible to read the username and/or password from a given ext/mysql resource.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.