Moto drops Mysql connection
Jack <[email protected]> 25 Feb 2003 12:56:41 -0700
| Newsgroups | gmane.comp.lang.moto.user |
|---|---|
| Message-ID | <[email protected]> |
--=-IbWX5Az0h0HhCAjjCwaU
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Hi,
I have this connection code:
#########################################################################################################################
$use("codex.db.mysql")
$use("codex.util")
$use("codex.http")
#readdefs("macro.lib")
<html>
<body BGCOLOR = #FFFFFF TEXT = #000000 marginheight="0" marginwidth="0"
topmargin="0" leftmargin="0" onLoad="Startup()">
${
MySQLConnection conn = new
MySQLConnection("localhost","db","user","pass");
String tableName = "transactions";
String query = "select * from " + tableName;
MySQLResultSet rset = conn.query(query);
}$
$declare(int cols=rset.getColumns())
$declare(int i)
$for(i=0;i<cols;i++)
$(rset.getColumnName(i))
$endfor
Okay, so Im just learning but... ;)
In any case this works about 50% of the time, and fails the other half
with this error:
Moto Error
/var/www/query.moto:15: Uncaught SQLException
message: Can't connect to MySQL server on 'localhost' (111)
SQLException thrown in MySQLConnection::MySQLConnection(4)(myconn.c:50)
called from function <main>(/var/www/query.moto:15)
Now, I thought it was MySQL, but I can connect with PhpMyAdmin just fine and still not connect with moto.
I ran a few of my other php scripts and it all seems to go just fine.
The system I am running:
Linux home 2.4.20-xfs #1 Tue Feb 18 19:00:05 MST 2003 i686 unknown unknown GNU/Linux
mysql-server 3.23.55
apache 1.3.27
debian testing/unstable 3.0
Thanks,
Jack
--=-IbWX5Az0h0HhCAjjCwaU--