## Forum archive 2000-2006

### Zoran - sql and ProblemSet problem

by Arnold Pizer -
Number of replies: 0
 sql and ProblemSet problem topic started 4/23/2004; 1:45:47 PMlast post 4/30/2004; 1:42:26 PM
Zoran - sql and ProblemSet problem
4/23/2004; 1:45:47 PM (reads: 2126, responses: 11)
Hi everyone.
=============================================================
First problem:
I followed steps for creating the course with mysql support from this web page:
http://devel.webwork.rochester.edu/twiki/bin/view/Webwork/CourseCreation
I am running mysql-server-3.23.58-1.9 and mysql-3.23.58-1.9.

These are the problems that I am getting:
-----------------------------------------------------
1. When I tried command:
	mysql> GRANT SELECT on webwork_sqltest.* to webworkRead@localhost       	-> IDENTIFIED BY PASSWORD('xyzzy');I got:	ERROR 1064: You have an error in your SQL syntax near '	-> IDENTIFIED BY PASSWORD('xyzzy')' at line 2---------------------------------------2. When I tried 	mysql> GRANT SELECT on webwork_sqltest.* to webworkRead@localhost       	-> IDENTIFIED BY PASSWORD 'xyzzy';I got:	ERROR 1133: Password hash should be a 16-digit hexadecimal number----------------------------------------3.When I tried:	mysql> GRANT SELECT on webwork_sqltest.* to webworkRead@localhost       	-> IDENTIFIED BY 'xyzzy';everthing was OK, but when I tried to execute bin/addcourse for db-layout=sql I got:DBI connect('webwork_demoCourse_WebWork2_sql','webworkRead',...) failed: Access denied for user: 'webworkRead@localhost' (Using password: NO) at /home/webwork/webwork-modperl/lib/WeBWorK/DB/Driver/SQL.pm line 39error instantiating DB schema WeBWorK::DB::Schema::SQL for table password: Can't call method "STYLE" without a package or object reference at /home/webwork/webwork-modperl/lib/WeBWorK/DB/Schema.pm line 81. at bin/addcourse line 167Everything was the same even when I hardcoded the RO and RW passwords in conf/database.conf.==================================================================================Second problem:I setup the course with gdbm (RedHat 9.0, Apache 1.3.29, mod-perl 1.29 and perl 5.8.0)When I build the Problem set (rochester_problib) and tried to access any of the problems I got Software error:
Algebra03Expressions : 5

### Software Error

WeBWorK has encountered a software error while attempting to process this problem. It is likely that there is an error in the problem itself. If you are a student, contact your professor to have the error corrected. If you are a professor, please consut the error output below for more informaiton.

### Error messages

Error detected while loading /home/webwork/webwork-modperl/pg/macros/PGchoicemacros.pl: PG_restricted_eval detected error at line 309 of file /home/webwork/webwork-modperl/pg/macros/PGchoicemacros.pl 'require' trapped by operation mask at /usr/lib/perl5/5.8.0/strict.pm line 19, <macrofile> chunk 1. Compilation failed in require at /home/webwork/webwork-modperl/pg/lib/WeBWorK/PG/Translator.pm line 76, <macrofile> chunk 1. BEGIN failed--compilation aborted at (eval 896) line 4, <macrofile> chunk 1. The calling package is main </macrofile></macrofile></macrofile>

### Error context

Problem5 ERROR caught by Translator while processing problem file:setAlgebra03Expressions/srw1_3_16.pg * Error detected while loading /home/webwork/webwork-modperl/pg/macros/PGchoicemacros.pl: PG_restricted_eval detected error at line 309 of file /home/webwork/webwork-modperl/pg/macros/PGchoicemacros.pl 'require' trapped by operation mask at /usr/lib/perl5/5.8.0/strict.pm line 19, <macrofile> chunk 1. Compilation failed in require at /home/webwork/webwork-modperl/pg/lib/WeBWorK/PG/Translator.pm line 76, <macrofile> chunk 1. BEGIN failed--compilation aborted at (eval 896) line 4,<macrofile> chunk 1. The calling package is main

<| Post or View Comments |>

 Sam Hathaway - Re: sql and ProblemSet problem  4/23/2004; 3:29:05 PM (reads: 2299, responses: 0) Your first problem: I couldn't tell from your notation above which characters you typed and which were output by mysql. What was the literal string that you typed? You should type: GRANT SELECT on webwork_myCourseName.* to webworkRead@localhost IDENTIFIED BY PASSWORD('readPassword'); GRANT SELECT, INSERT, UPDATE, DELETE on webwork_myCourseName.* to webworkWrite@localhost IDENTIFIED BY PASSWORD('writePassword'); (Replace readPassword and writePassword with secure passwords.) I am not sure about your second problem. -sam <| Post or View Comments |>

 Zoran - Re: sql and ProblemSet problem  4/23/2004; 4:19:25 PM (reads: 2272, responses: 0) Hi Sam. I typed just as it is in your response: GRANT SELECT on webwork_someCourseName.* to webworkRead@localhost IDENTIFIED BY PASSWORD('somepswd'); and mysql output is : ERROR 1064: You have an error in your SQL syntax near '('somepswd')' at line 1 Zoran. <| Post or View Comments |>

 Thomas R. Shemanske - Re: sql and ProblemSet problem  4/25/2004; 10:14:17 AM (reads: 2281, responses: 0) I have WW2 running with a sql database, and while I am hardly more than a novice with mysql, I can make some configuration suggestions. In looking at the current Wiki documentation to which you refer above, there seems no mention of the creation of the users webworkRead and webworkWrite in the mysql user table.  If they do not already exist in your msyql.user table add them as follows (replacing testuser and testpasswd with webworkRead/Write and the passwords which are in conf/database.conf): webwork:~# mysql -u root -p Enter password: mysql> INSERT INTO mysql.user (Host,User,Password) VALUES ('localhost','testuser',PASSWORD('testpasswd')); Query OK, 1 row affected (0.00 sec)   mysql> FLUSH PRIVILEGES; mysql> quit; Now create your course tables as indicated with the documented syntax:mksqldb myCourseName | mysql -u root -p Finally grant privileges with the modified statements mysql -u root -p Enter password:mysql> GRANT SELECT on webwork_myCourseName.* to webworkRead@localhost;Query OK, 0 rows affected (0.00 sec)and the similarly for webworkWrite. Here you are deleting the IDENTIFIED phrase. It should not be necessary to use the "IDENTIFIED" phrase as you are modifying the table mysql.db with the above command (as root). As a general comment, if you support php on your webserver, the package phpmyadmin provides an outstanding web-based interface to all your mysql databases. T<| Post or View Comments |>

 Zoran - Re: sql and ProblemSet problem  4/26/2004; 2:20:15 PM (reads: 2250, responses: 0) Hi Sam. Hi Tom. I appriciate your responses very much. Finally I found what was wrong! Don't put special characters into your password like @ or #!!! As for the second problem, I am still confused. Regards Zoran. <| Post or View Comments |>

 Thomas R. Shemanske - Re: sql and ProblemSet problem  4/26/2004; 3:25:44 PM (reads: 2259, responses: 0) To try to corroborate, I just built that set (with sql db), and the only errors I encountered were from legacy comments in setAlgebra03Expressions.def file which caused some minor pink screens (for files not found), but which were rectified by commenting out the lines: #paperHeaderFile = paperSetHeader.pg #screenHeaderFile = screenSetHeader.pg This is not your problem, but at least one to be aware of. Tom<| Post or View Comments |>

 Zoran - Re: sql and ProblemSet problem  4/27/2004; 12:37:43 PM (reads: 2250, responses: 0) I am definitely having problem with PGchoicemacros.pl and the version of perl I am using. ([root@www2 root]# rpm -qa |grep perl perl-Filter-1.29-3 perl-XML-Dumper-0.4-25 perl-DBI-1.32-5 perl-DateManip-5.40-30 perl-libwww-perl-5.65-6 perl-SGMLSpm-1.03ii-11 perl-DBD-MySQL-2.1021-3 perl-Parse-Yapp-1.05-30 perl-XML-Parser-2.31-15 perl-libxml-enno-1.02-29 perl-5.8.0-88.3 perl-CPAN-1.61-88.3 perl-suidperl-5.8.0-88.3 perl-HTML-Parser-3.26-17 perl-libxml-perl-0.07-28 perl-XML-Grove-0.46alpha-25 perl-DBD-Pg-1.21-2 perl-DB_File-1.804-88.3 perl-HTML-Tagset-3.03-28 perl-XML-Twig-3.09-3 perl-URI-1.21-7 perl-XML-Encoding-1.01-23 perl-CGI-2.81-88.3 [root@www2 root]#) ======================================================================= This is screenHeaderFile0.pg file for set 0: When I don't comment PGchoicemacros.pl, I am getting: Software Error WeBWorK has encountered a software error while attempting to process this problem. It is likely that there is an error in the problem itself. If you are a student, contact your professor to have the error corrected. If you are a professor, please consut the error output below for more informaiton. Error messages Error detected while loading /home/webwork/webwork-modperl/pg/macros/PGchoicemacros.pl: PG_restricted_eval detected error at line 309 of file /home/webwork/webwork-modperl/pg/macros/PGchoicemacros.pl 'require' trapped by operation mask at /usr/lib/perl5/5.8.0/strict.pm line 19, chunk 1. Compilation failed in require at /home/webwork/webwork-modperl/pg/lib/WeBWorK/PG/Translator.pm line 76, chunk 1. BEGIN failed--compilation aborted at (eval 2655) line 3, chunk 1. The calling package is main Error context Problem0 ERROR caught by Translator while processing problem file:set0/screenHeaderFile0.pg * Error detected while loading /home/webwork/webwork-modperl/pg/macros/PGchoicemacros.pl: PG_restricted_eval detected error at line 309 of file /home/webwork/webwork-modperl/pg/macros/PGchoicemacros.pl 'require' trapped by operation mask at /usr/lib/perl5/5.8.0/strict.pm line 19, chunk 1. Compilation failed in require at /home/webwork/webwork-modperl/pg/lib/WeBWorK/PG/Translator.pm line 76, chunk 1. BEGIN failed--compilation aborted at (eval 2655) line 3, chunk 1. The calling package is main * ------Input Read 1 ##Screen set header for set 0, Fall 1998 2 3 &DOCUMENT; 4 5 loadMacros( 6 PG.pl, 7 PGbasicmacros.pl, 8 PGchoicemacros.pl, 9 PGanswermacros.pl 10 ); 11 12 13 14 BEGIN_TEXT; 15 WeBWorK assignment number $setNumber is due$formatedDueDate. 16 17 $PAR 18 This first problem set (set 0) is designed to acquaint you with using WeBWorK. 19 YOUR SCORE ON THIS SET WILL NOT BE COUNTED TOWARD YOUR FINAL GRADE. 20 In addition to doing the screen problems, practice getting a hard copy print out of the 21 problem set. You probably won't need it for this problem set, but you may in the future. 22 If you need software installed on your own computer look 23 { htmlLink("/index.html#software","here")}. 24$PAR 25 The primary purpose of WeBWorK is to let you know if you are getting the right answer or to alert 26 you if you get the wrong answer. Usually you can attempt a problem as many times as you want before 27 the due date. However, if you are having trouble figuring out your error, you should 28 consult the book, or ask a fellow student, one of the TA's or 29 your professor for help. Don't spend a lot of time guessing -- it's not very efficient or effective. 30 $PAR 31 32 You can use the Feedback button on each problem 33 page to send e-mail to the professors. 34$PAR 35 Give 4 or 5 significant digits for (floating point) numerical answers. 36 For most problems when entering numerical answers, you can if you wish 37 enter elementary expressions such as 2^3 instead of 8, sin(3pi/2) instead 38 of -1, e^(ln(2)) instead of 2, 39 (2+tan(3))*(4-sin(5))^6-7/8 instead of 27620.3413, etc. 40 41 Here's the 42 { htmlLink(qq!http://webwork.math.rochester.edu/webwork_system_html/docs/docs/pglanguage/availablefunctions.html!,"list of the functions") } 43 which WeBWorK understands. 44 END_TEXT 45 46 &ENDDOCUMENT; -- When I comment PGchoicemacros.pl, output is: WeBWorK assignment number 0 is due 01/01/05 at 02:00am. This first problem set (set 0) is designed to acquaint you with using WeBWorK. YOUR SCORE ON THIS SET WILL NOT BE COUNTED TOWARD YOUR FINAL GRADE. In addition to doing the screen problems, practice getting a hard copy print out of the problem set. You probably won't need it for this problem set, but you may in the future. If you need software installed on your own computer look here . The primary purpose of WeBWorK is to let you know if you are getting the right answer or to alert you if you get the wrong answer. Usually you can attempt a problem as many times as you want before the due date. However, if you are having trouble figuring out your error, you should consult the book, or ask a fellow student, one of the TA's or your professor for help. Don't spend a lot of time guessing -- it's not very efficient or effective. You can use the Feedback button on each problem page to send e-mail to the professors. Give 4 or 5 significant digits for (floating point) numerical answers. For most problems when entering numerical answers, you can if you wish enter elementary expressions such as 2^3 instead of 8, sin(3pi/2) instead of -1, e^(ln(2)) instead of 2, (2+tan(3))*(4-sin(5))^6-7/8 instead of 27620.3413, etc. Here's the list of the functions which WeBWorK understands. Any suggestions? Zoran <| Post or View Comments |>

 Zoran - Re: sql and ProblemSet problem  4/29/2004; 3:39:42 PM (reads: 2255, responses: 0) Some more input: ====================== When I do: # perl PGchoicemacros.pl output is: Undefined subroutine &main::be_strict called at PGchoicemacros.pl line 310. BEGIN failed--compilation aborted at PGchoicemacros.pl line 311. ===================================================================== I deleted first three lines of PGchoicemacros.pl located in pg/macros. Lines are: BEGIN { be_strict; { I got now better results, still far from OK. Buttons are good, but image redering is not working. Is it because of cutting those three lines? Result is: Algebra02ExponentsRadicals : 4 (1 pt) Evaluate the expression displaystyle left( frac{2}{-2} right)^2 . [NOTE: Your answer cannot be an algebraic expression. ] Show correct answers You have attempted this problem 0 times. You have unlimited attempts remaining. Edit this problem Software Warnings WeBWorK has encountered warnings while attempting to process this problem. It is likely that this indicates an error or ambiguity in the problem itself. If you are a student, contact your professor to have the problem corrected. If you are a professor, please consut the warning output below for more informaiton. Warning messages * cd /home/webwork/webwork-modperl/tmp/ImageGenerator.PQExuUbZ && /usr/local/bin/latex equation > latex.out 2> latex.err returned non-zero status 32512: Inappropriate ioctl for device at /home/webwork/webwork-modperl/pg/lib/WeBWorK/PG/ImageGenerator.pm line 263. * cd /home/webwork/webwork-modperl/tmp/ImageGenerator.PQExuUbZ failed at /home/webwork/webwork-modperl/pg/lib/WeBWorK/PG/ImageGenerator.pm line 264. * Unable to execute /usr/local/bin/latex at /home/webwork/webwork-modperl/pg/lib/WeBWorK/PG/ImageGenerator.pm line 266. * total 8 * -rw-r--r-- 1 webwork webwork 233 Apr 29 13:36 equation.tex * -rw-r--r-- 1 webwork webwork 60 Apr 29 13:36 latex.err * -rw-r--r-- 1 webwork webwork 0 Apr 29 13:36 latex.out * Unable to read logfile /home/webwork/webwork-modperl/tmp/ImageGenerator.PQExuUbZ/equation.log at /home/webwork/webwork-modperl/pg/lib/WeBWorK/PG/ImageGenerator.pm line 278. * cd /home/webwork/webwork-modperl/tmp/ImageGenerator.PQExuUbZ && /usr/local/bin/latex equation > latex.out 2> latex.err failed to generate a DVI file at /home/webwork/webwork-modperl/pg/lib/WeBWorK/PG/ImageGenerator.pm line 282. * cd /home/webwork/webwork-modperl/tmp/ImageGenerator.PQExuUbZ && /usr/local/bin/dvipng -x4000.5 -bgTransparent -Q6 -mode toshiba -D180 equation > dvipng.out 2> dvipng.err returned non-zero status 32512: No such file or directory at /home/webwork/webwork-modperl/pg/lib/WeBWorK/PG/ImageGenerator.pm line 288. Zoran. <| Post or View Comments |>

 Michael Gage - Re: sql and ProblemSet problem  4/29/2004; 4:56:27 PM (reads: 2242, responses: 0) Cutting out the first three lines (calling be_strict) does solve the first problem as it should. It is occuring because of an interaction between perl 5.8.0 and the Safe.pm compartment. We have run into this before, but I don't remember if there was a better way to resolve the problem. (John Jones or Sam do you remember?) In any case removing these three lines simply removes some warning messages -- the ones you get if you add use stict; in ordinary perl programming. This makes a difference if you are modifying the PGchoicemacros.pl file since you will not get as many warning messages and it's harder to detect bugs, however it doesn't affect how the file works. Your new bug has to do with some kind of permissions problem. Either the directory /home/webwork/webwork-modperl/tmp doesn't exist or the webserver can't create a new file in that directory or it can't execute that directory. You will, for now, have to remove the be-strict lines at the top of each of the files in the pg/macros directory. It will take a bit of research to figure out what has to be done to the subroutine be_strict to make it compatible with Safe.pm and perl 5.8.0 --Mike <| Post or View Comments |>

 Zoran - Re: sql and ProblemSet problem  4/29/2004; 6:17:47 PM (reads: 2221, responses: 0) Thanx Mike. I did commented be_strict, so it is working fine. I fixed missing folder problems, as well as permission problems. Everything is white now and it makes me very happy. There is one more problem: Instead of figures, I am getting blank frames. Clicking on frames get me to Not found page. It is pointing to: http://myserver/webwork-modperl_files/courses/myCourseName/tmp/gif/ I got the proper page with WebWork 2 welcome when I go to: http://myserver/webwork-modperl_files Of course under htdocs, there is nothing like courses folder. Even creating whole structure didn't help. Is it problem with my apache config file or smth else? Zoran. <| Post or View Comments |>

 Michael Gage - Re: sql and ProblemSet problem  4/29/2004; 8:54:25 PM (reads: 2218, responses: 0) I think this is a problem with a configuration in global.conf. There was a mistake in at least one version of global.conf that was distributed. This section corresponds to the files stored in the course directory (including on the fly images) my $courseURLRoot = "/webwork2_courses/$courseName";%courseURLs = ( root => "$courseURLRoot", html => "$courseURLRoot", html_temp => "$courseURLRoot/tmp",); and should match this stanza in the httpd.conf file AliasMatch /webwork2_courses/([^/]*)/(.*) /webwork/shared-courses/$1/html/$2 notice that the url for the gifs should contain /webwork2_courses/ because the temporary images are stored under the myCourse/html directory, not in the main webwork-modperl/htdocs directory. Some copies of global.conf were distributed with my$courseURLRoot = "/webwork2_files/\$courseName"; and this is not correct. Hope this helps. --Mike <| Post or View Comments |>

 Zoran - Re: sql and ProblemSet problem  4/30/2004; 1:42:26 PM (reads: 2239, responses: 0) Thanx Mike. I appreciate your help. It's working now. Regards Zoran.<| Post or View Comments |>