r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[MySQL]

Maxim
25-Jan-2005
[40x5]
The server I am accessing is very quick and in general, it accomplishes 
its query in micro seconds.  so its not really a question of server 
load...
Doc.   my very competent db admin, told me that it could simply be 
an issue that the client is expecting a reply from the sql server 
too quickly and that it is likely a simple timeout issue.  HTH.  
 if there is a way to let the tcp wait a bit more, it could be that 
the fraction of a second more needed might be all that is required.
Doc,   for my useage, the access denied error happens 100% randomly. 
   more connections only mean more chances of getting the error, 
but I've had it fail on the very first connection attempt and have 
had several thousand go without errors...   then I'll have 5 within 
a 100 ... there really is no pattern I can detect.
Gabriel, yes the async core makes it harder to make the core synchronous...
my current app is so threaded because of the async core that its 
impressed everyone at the office... I can be scrolling a list view, 
reading files doing sql queries and reading directory lists which 
buildup view menus in real time... everything is fluding and strangely, 
having sql and a loop browsing through several hundred directories 
scanning their content is almost unnoticeable !!!!!!    scrolling 
speed goes down by maybe 20%... but network access remains pretty 
steady... congrats to RT...
rolf
26-Jan-2005
[45]
@Gab:  no WAIT is used, it is just a wrapper for ease of use.  it 
also selects local db or Rugby
Gabriele
26-Jan-2005
[46]
rofl: if you have no wait, then i don't see how you could get that 
code called "concurrently"?
Dockimbel
26-Jan-2005
[47x4]
Maxime: Thanks for the info.
Looking at my mysql:// code ('do-handshake and 'read-packet functions), 
I notice that I didn't use any 'wait to synchronize with the server. 
Instead it loops on 'read-io until it gets all the data expected 
which may waste some cpu time. Looking today, I'll say that's not 
the best way to do that, and the code stability could benefit from 
a couple of 'wait calls. I should definitely rewrite the low level 
stuff.
Maxim: if you're guessed right on the access denied issue, you should 
be able to fix it by addind a few 'wait 0.01 to the 'do-handshake 
function. Put one 'wait just before each call to 'read-packet and 
if you have time do some tests.
you're => you've
Gabriele
26-Jan-2005
[51x2]
Doc: problem is we don't know if having WAIT inside handlers is a 
good thing or not
also, that will create problems to view apps (see rolf problem above)
Dockimbel
26-Jan-2005
[53]
Good point. RT should give us more info regarding the recursive handlers 
calls issues in event loop.
rolf
26-Jan-2005
[54]
@Gabrielle: AFAIK the scroller events just  fire the SQL requests 
when the scroller is moved. So the request can overlap in time. The 
simple trick above solved the problem.
Gabriele
26-Jan-2005
[55]
rolf: if you have no wait, they cannot overlap. REBOL is single threaded.
rolf
26-Jan-2005
[56]
Ok , I understand the View eventloop is no separate thread,  but 
 funny enough my little trick worked.
Tim
18-Feb-2005
[57x2]
I am having problems connecting to mysql on windows XP. The error 
message I get is "Client does not support authentication protocol". 
I'm using localhost as the host and have granted all priviliges for 
['user''-:-'localhost'']  identified by ''password' .... etc. I'm used 
to linux, and it''s been
a long time..... oops sorry about the errant entry key. Ideas anybody? 
-- tim --
Terry
18-Feb-2005
[59]
Dear Tim, 
Have you tried connecting to it via mysql.exe?
Tim
18-Feb-2005
[60]
yes. I connect without incident.
Terry
18-Feb-2005
[61x2]
hmm.. and you are using Mysql-prot.r ?
(or whatever the Rebol mysql protocol is called)?
Tim
18-Feb-2005
[63]
correct. Do I need to add any entries to the 'host' table?
Terry
18-Feb-2005
[64]
I've never changed it.. and it's worked fine..
Tim
18-Feb-2005
[65]
There are some gotchas using 'localhost'. Now on my linux machine, 
when I changed my I.P. from 192.168.1.1 to 192.168.1.6, I then had 
to connect using my machine's hostname (which was "linus") . If I 
attempt to connect using this machine's hostname (lucy) I get : MYSQL 
ERROR 1045 : Access denied for user ['tim'-:-'lucy'] (using password: 
YES). And I *have* also granted privileges to [tim-:-lucy] indentified 
by 'password''
Terry
18-Feb-2005
[66x2]
try this from your rebol console.. 

do load http://powerofq.com/start
°load° "°mysqlprot°"


a: read join mysql://yourName:[yourPassword-:-localhost]/yourDatabaseName 
"show tables"
(change the user/pass/db etc)
Tim
18-Feb-2005
[68x2]
Oh boy! Now we're getting into some good stuff! Sorry, I have to 
leave for an hour or so. I will try that as soon as I get back. Thanks....
Here are the results: >> do load http://powerofq.com/start
connecting to: powerofq.com
>> load "mysqlprot"
== mysqlprot
a: read join mysql://tim:[password-:-localhost]/hs4u "show tables"
>> a: read join mysql://tim:[password-:-localhost]/hs4u "show tables"

** Access Error: Invalid port spec: mysql://tim:[password-:-localhost]/hs4ushow 
tables

** Near: a: read join mysql://tim:[password-:-localhost]/hs4u "show tables"
Alberto
18-Feb-2005
[70]
Tim: MySQL 4.1 uses a new encryption method for user passwords, try 
add a new user assigning the password with the function OLD_PASSWORD('pass') 
rather than PASSWORD('pass'), and attempt   open mysql:// ... etc. 
 with the new user. Hope this helps.
Tim
18-Feb-2005
[71]
Do you have a syntax example of that? I added users with the GRANT 
...... IDENTIFIED BY ..... approach
Alberto
18-Feb-2005
[72]
I don't remeber the syntax exactly, wait me a minute...
Tim
18-Feb-2005
[73]
I googled it and added the user as per the OLD-Password syntax. Now 
I tried a: read join mysql://tim:[password-:-localhost]/hs4u "show tables"
and got the same error message
Alberto
18-Feb-2005
[74]
Sorry,I did not read all messages... Why are you using 'read rather 
than 'open ?
Tim
18-Feb-2005
[75x4]
:-) following instructions trying: open mysql://tim:[pwd-:-localhost]/hs4u 
getting ** Access Error: Invalid port spec: mysql://tim:[pwd-:-localhost]/hs4u
** Near: open mysql://tim:[pwd-:-localhost]/hs4u
I'm going to try it with the mysql-protocol module that I am using 
on my desktop. Just a minute...
worked from the console, but I'm not getting in with the cgi program. 
hmmm ....
Bolixed my code that's why. I am in! Alberto, thank you very much. 
I really appreciate the tip. You made it work for me.... cheers tj
Alberto
18-Feb-2005
[79]
You are wellcome :-)
Guest
20-Feb-2005
[80]
any idea how to get(read) a string from a integer pointer, delivered 
by mysql.dll ? is there something like  - get-string  :integerpointer 
?
Gabriele
22-Feb-2005
[81]
declare it as string!, not integer!.
Guest
22-Feb-2005
[82]
yes gabriele, it works fine for this ->  char *mysql_info(MYSQL *mysql) 
 points to a char, but this -> MYSQL_RES *mysql_list_tables(MYSQL 
*mysql, const char *wild) delivers the integer pointer again as string. 
I know I have to provid a struct! which will be filled by passing 
the pointer to the routine but can I pass just a empty block instead 
a struct! ?, or better pass the recieved integer pointer later to 
a block ?
Gabriele
23-Feb-2005
[83x3]
i think you should declare the return value as a struct. how is MYSQL_RES 
defined?
anyway, have a look at http://www.compkarori.com/vanilla/display/peek_and_poke.r
maybe it can be useful to you.
DideC
25-Feb-2005
[86]
Dummy question: is it possible to insert more than one SQL statement 
in one time ?
ie:

insert mysql-db {INSERT INTO table VALUES (1, "USA"); INSERT INTO 
table VALUES (2, "FRANCE"); INSERT INTO table VALUES (3, "ITALY")}
Sunanda
25-Feb-2005
[87]
This works with some SQLs -- not trie dit with mySQL
 INSERT INTO table
   select (1, "USA")
   union all  select (2, "FRANCE")
   union all  select (3, "ITALY")
DideC
25-Feb-2005
[88x2]
According MySQL doc, I can use this syntax for INSERT :
INSERT INTO table VALUES (1, "USA"), VALUES (2, "FRANCE"), VALUES 
(3, "ITALY")