[REBOL] Re: network timeout with mysql-protocol.r 0.8.5
From: dockimbel:free at: 28-Mar-2001 0:07
> The MySQL scheme for /Core is pretty nice so far. But I frequently
> encounter network timeouts, often when it has been less than 90 seconds
> since the last activity. Do I need to 'open and 'close the database for
> each entry? Is it common for a database connection to timeout so quickly?
> (I'm new at using SQL of any kind, but REBOL is getting me there.) Here is
> my script:
You shouldn't open multiple mySQL port at the same time. Currently all the
opened ports will share the same words controling the communication process.
If you open mysql:// 2 times without closing the port, it would result in
a timeout. This behaviour will be corrected in the next release and will
allow to work with unlimited mySQL ports opened at the same time.
(See the TODO list in the doc.)
> REBOL 
> do %mysql-protocol.r
> print "MySQL protocol loaded"
> print newline
> database: open mysql://username:[password--localhost]/test
> print "Test database loaded"
> print newline
> forever [
> print "Author:" author: input
> print "Subject:" subject: input
> print "Content:" content: input
> insert database ["insert into messages values (?,?,?)" author subject
> print "Values inserted into table"
Currently you should replace the following line :
> probe read join mysql://username:[password--localhost]/test? "select *
> from messages"
insert database "select * from messages"
probe copy database
Why opening another connection to the server when you can use the currently
opened one ? And don't forget to close the port when exiting from the
forever loop (!) :