1. edbi + mysql + linux missing driver and password question

I seem to be missing the edbi mysql driver. Where can I get this? I have a fairly recent version of edbi (about one or two months old) for version 4 of eu. My compiled version of sqlite3 works fine.

ant@anthill:/usr/share/euphoria/edbi/drivers/mysql$ ls 
edbi_mysql.e  eu.cfg 

eui test.ex 
 
/usr/share/euphoria/include/std/error.e:52 in procedure crash()  
Could not open driver as: 
  /usr/share/euphoria/edbi/drivers/mysql/edbi_mysql.so 
  /usr/share/euphoria/edbi/drivers/edbi_mysql.so 
  edbi_mysql.so  
 
... called from /usr/share/euphoria/include/std/../../edbi/edbi/edbi.e:334 in function open()   
 
... called from /var/www/cgi/test.ex:22  
 
--> See ex.err  
 

I also have a question about a database password, if it has a ':' in it will it work as in:

 
edbi:open("mysql://dbuser:my_password_with_a:@localhost?dbname=mydb") 
 

Thanks for your help.

new topic     » topic index » view message » categorize

2. Re: edbi + mysql + linux missing driver and password question

Anthill said...

I seem to be missing the edbi mysql driver. Where can I get this? I have a fairly recent version of edbi (about one or two months old) for version 4 of eu. My compiled version of sqlite3 works fine.

ant@anthill:/usr/share/euphoria/edbi/drivers/mysql$ ls 
edbi_mysql.e  eu.cfg 

eui test.ex 
 
/usr/share/euphoria/include/std/error.e:52 in procedure crash()  
Could not open driver as: 
  /usr/share/euphoria/edbi/drivers/mysql/edbi_mysql.so 
  /usr/share/euphoria/edbi/drivers/edbi_mysql.so 
  edbi_mysql.so  
 
... called from /usr/share/euphoria/include/std/../../edbi/edbi/edbi.e:334 in function open()   
 
... called from /var/www/cgi/test.ex:22  
 
--> See ex.err  
 

You need to compile edbi_mysql.e using euc -dll

new topic     » goto parent     » topic index » view message » categorize

3. Re: edbi + mysql + linux missing driver and password question

Anthill said...

I also have a question about a database password, if it has a ':' in it will it work as in:

edbi:open("mysql://dbuser:my_password_with_a:@localhost?dbname=mydb") 

You can try encoding the : as %3A and see if that works. I suspect it will, but have not tested.

Jeremy

new topic     » goto parent     » topic index » view message » categorize

4. Re: edbi + mysql + linux missing driver and password question

Anthill said...

I also have a question about a database password, if it has a ':' in it will it work as in:

 
edbi:open("mysql://dbuser:my_password_with_a:@localhost?dbname=mydb") 
 

Thanks for your help.

edbi passed the connection string directly to the driver. The sqlite3 driver passes it directly to the sqlite3 library unmodified. So if the sqlite3 library can handle it, then it'll work.

The mysql driver for edbi parses the string directly using std/net/url.e's url:parse(). My test code shows that url:parse() returns the password correctly (with a ':'), so mysql should work fine.

include std/net/url.e 
sequence s = url:parse("mysql://dbuser:my_password_with_a:@localhost?dbname=mydb") 
puts(1, s[URL_PASSWORD]) 
new topic     » goto parent     » topic index » view message » categorize

5. Re: edbi + mysql + linux missing driver and password question

I compiled:

ant@anthill:/usr/share/euphoria/edbi/drivers/mysql$ euc -dll edbi_mysql.e  
Build directory: ./build-127038./ 
Translating code, pass: 1 2 3 4  generating 
Compiling with GCC 
Compiling   1% init-.c 
Compiling   6% edbi_mysql.c 
Compiling  10% main-.c 
Compiling  13% datetime.c 
Compiling  16% machine.c 
Compiling  20% memconst.c 
Compiling  23% memory.c 
Compiling  27% error.c 
Compiling  30% dll.c 
Compiling  33% convert.c 
Compiling  37% types.c 
Compiling  40% sequence.c 
Compiling  44% search.c 
Compiling  47% sort.c 
Compiling  50% math.c 
Compiling  54% rand.c 
Compiling  57% text.c 
Compiling  61% filesys.c 
Compiling  64% wildcard.c 
Compiling  67% io.c 
Compiling  71% map.c 
Compiling  74% get.c 
Compiling  77% primes.c 
Compiling  81% stats.c 
Compiling  84% pretty.c 
Compiling  88% eumem.c 
Compiling  91% serialize.c 
Compiling  94% eds.c 
Compiling  98% url.c 
Linking 100% /usr/share/euphoria/edbi/drivers/mysql/edbi_mysql.so 
ant@anthill:/usr/share/euphoria/edbi/drivers/mysql$ ls 
edbi_mysql.e  edbi_mysql.so  eu.cfg 

However upon running my eu script I get the following error:

ant@anthill:/var/www/cgi$ eui test.ex 
 
Fatal run-time error: 
Could not find a suitable MySQL shared library 
 

new topic     » goto parent     » topic index » view message » categorize

6. Re: edbi + mysql + linux missing driver and password question

I also tried compiling with:

euc -so edbi_mysql.e 

but that still gives the same error upon running my script.

Fatal run-time error: 
Could not find a suitable MySQL shared library 

Any more suggestions?

new topic     » goto parent     » topic index » view message » categorize

7. Re: edbi + mysql + linux missing driver and password question

You need to move the edbi_mysql.so to /usr/local/lib and then run ldconfig.

new topic     » goto parent     » topic index » view message » categorize

8. Re: edbi + mysql + linux missing driver and password question

jaygade said...

You need to move the edbi_mysql.so to /usr/local/lib and then run ldconfig.

Tried that but still get the same error. I also set the edbi's driver path to: edbi:set_driver_path("/usr/local/lib")

Fatal run-time error: 
Could not find a suitable MySQL shared library 

new topic     » goto parent     » topic index » view message » categorize

9. Re: edbi + mysql + linux missing driver and password question

I did the following to get EDBI/Mysql to work with EU 4 on Ubuntu 10.04. Towards the top of your edbi_mysql.e file, look for the line:

constant lib_mysql = open_dll({  

You need to add your particular Mysql shared library on your computer to this list of possible files. For example, I have the package "libmysqlclient16-dev" installed on my system so my shared library file is "/usr/lib/libmysqlclient.so.16.0.0". Then just recompile the dll, move it, and ldconfig. You should be good to go!

Hope this helps,
Ira

new topic     » goto parent     » topic index » view message » categorize

10. Re: edbi + mysql + linux missing driver and password question

Jerome said...

I did the following to get EDBI/Mysql to work with EU 4 on Ubuntu 10.04. Towards the top of your edbi_mysql.e file, look for the line:

constant lib_mysql = open_dll({  

You need to add your particular Mysql shared library on your computer to this list of possible files. For example, I have the package "libmysqlclient16-dev" installed on my system so my shared library file is "/usr/lib/libmysqlclient.so.16.0.0". Then just recompile the dll, move it, and ldconfig. You should be good to go!

Hope this helps,
Ira

Thanks for the reply.

Well this seems to get me one step closer, however, I get another error:

/usr/share/euphoria/include/std/../../edbi/edbi/edbi.e:348 in function open()                                                       
A machine-level exception occurred during execution of this statement                                                               
  321:      sequence driver = _[1], conn_str = _[2]                                                                                 
... called from /var/www/cgi/test.ex:23 ("%s/%s/edbi_%s.%s", { driver_path, driver, driver, SHARED_LIB_EXT })                       
  323:      sequence dll_name2 = sprintf("%s/edbi_%s.%s", { driver_path, driver, SHARED_LIB_EXT })                                  
--> See ex.err uence dll_name3 = sprintf("edbi_%s.%s", { driver, SHARED_LIB_EXT })                                                  
ant@anthill:/var/www/cgi$  

Is there something else I might be missing?

Thanks...

new topic     » goto parent     » topic index » view message » categorize

11. Re: edbi + mysql + linux missing driver and password question

I usually received machine-level exceptions when I passed a bad Mysql command through edbi. Here is a copy of my function to open my 'CookingRecipes' database for user 'jerome' that is not password protected:

include edbi/edbi.e 
/*----------------------------------------------------------------------- 

--                 OpenDB 
-------------------------------------------------------------------------*/ 
public function OpenDB() 
 
edbi:set_driver_path("/usr/lib/cgi-bin/edbi") 
edbi:db_handle dbh = edbi:open("mysql://jerome@localhost/CookingRecipes") 
 
if dbh = 0 then 
        printf(1, "DBI failed to connect: %s\n", { dbh }) 
        abort(1) 
else 
       puts(1," DBI opened! \n") 
end if 
return dbh 
end function 

Is your syntax similar?

Thanks, Ira

new topic     » goto parent     » topic index » view message » categorize

12. Re: edbi + mysql + linux missing driver and password question

Jerome said...

I usually received machine-level exceptions when I passed a bad Mysql command through edbi. Here is a copy of my function to open my 'CookingRecipes' database for user 'jerome' that is not password protected:

Is your syntax similar?

Thanks, Ira

Thanks. I owe you a beer.

The example that I was working against looked like:

--Did not work 
edbi:db_handle dbh = edbi:open("mysql://user:secret@localhost?dbname=TM")  
 
--This Works 
edbi:db_handle dbh = edbi:open("mysql://user:secret@localhost/TM")  
new topic     » goto parent     » topic index » view message » categorize

13. Re: edbi + mysql + linux missing driver and password question

EDBI is pretty functional but not 1.0 yet due to its lack of testing and good error handling, sorry about that.

If anyone wishes to help w/EDBI to bring it to 1.0 status, I'd be very happy to accept the help. I could provide write access to the repository and you of course would be listed as a developer on the EDBI project.

Jeremy

new topic     » goto parent     » topic index » view message » categorize

14. Re: edbi + mysql + linux missing driver and password question

Anthill,

I'm glad I could help!

Jeremy,

I would be interested in helping with the testing/debugging of EDBI. I do a fair amount of programming for work and fun, but I am by no means an expert. In what ways could I get involved?

- Ira

new topic     » goto parent     » topic index » view message » categorize

15. Re: edbi + mysql + linux missing driver and password question

I would be interested in helping.

new topic     » goto parent     » topic index » view message » categorize

16. Re: edbi + mysql + linux missing driver and password question

I've emailed both of you. Ira, I removed your message due to the email in a format bots could scrape.

Thanks for offering to help out!

Jeremy

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu