__________________
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php
__________________
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php
Ack, same thing with the createStatement off of the Connect. Lol, its confusing having such similar names.
Chain the connect.createStatement to return the conn.createStatement. That explains why we can create a statement successfully, but can't operate on it.
__________________
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php
Hah, sorry.
Connection is wrapped within your Connect class. So in your SqlMethods class when it accesses the Connect class, you cannot directly access the methods of Connection. What you must do is present them yourself, so your Connect class must do this:
PHP Code:
public Statement createStatement() { return this.conn.createStatement(); // currently your method returns null. }
In the long run, I don't think you'll end up using the createStatement in conjunction with the Connect class. I expect that you will instead use a embedded handling for the Connect, and expose a method similar to the Statement.execute[query] methods.
If you wanted to push it to the max, you could implement Connection, Statement, DatabaseMetaData, and a few others like PreparedStatements and whatnots, and actually have a single class emulate every aspect of the Java SQL world. That doesn't sound too fun though.
__________________
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php
that makes more sense. I'm getting close!
with that last update, this is whats returned:
Database connection established
SQL Exception: No operations allowed after connection closed.
if I comment out conn.close (); everything works. so I'm wondering why the connection gets closed so soon?
thanks again for all your help!
Oh yeah, thats right. Finally always tries to execute if a try block exists. Move the code from the finally block into the catch block and remove the finally block (erm, I think that makes sense lol). The nested catch will likely need to use a new variable name for the Exception since the outer catch will use e. I can see it freaking out if it goes unchanged.
__________________
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php