Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

MySql Administrator gui

 
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Running MySql Server 5.0 on Vista, I am having several problems setting up logging correctly.

I am not allowed to bounce the server through the Administrator GUI.
I'm guessing it is a permissions problem. How do I sort this out?

I have set the query log file name, but I think I need to set GLOBAL sql_log_off = 'ON';at the command line as I don't see how to do this through the GUI.

What is suggested to include in my.ini?

The goal is to see what a PreparedStatement is actually sending to the server; the PreparedStatement works at the command line but not within the servlet.

My lack of experience with these tools is showing because I have spent almost two days ( and nights! ) on this.

Thanks.
 
author & internet detective
Posts: 39997
807
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Mary Taylor wrote:The goal is to see what a PreparedStatement is actually sending to the server; the PreparedStatement works at the command line but not within the servlet.


Why not use System.out.println. Or a logging driver like jamon? Then you don't need admin privileges or to fiddle with MySql.
 
Mary Taylor
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
System.out.println doesn't show the actual query that hits the database. I finally got
query logging working and was able to see that, for some reason, the parameter is
not being inserted in the PreparedStatement. When the query hits the db, the "?"
mark is still actually in the query! I have another successful query that looks exactly like the one
that fails; different columns are being queried, but the successful one has the value
set in the query whereas the unsuccessful one does not. I cannot see any difference in the
code.

 
Jeanne Boyarsky
author & internet detective
Posts: 39997
807
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think Jamon does replace the values. In any case, you could post the query here with the "?" and see if anyone knows what is wrong. My guess would be a setXXX is incorrect.
 
Jeanne Boyarsky
author & internet detective
Posts: 39997
807
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jeanne Boyarsky wrote:I think Jamon does replace the values. In any case, you could post the query here with the "?" and see if anyone knows what is wrong. My guess would be a setXXX is incorrect.


Which actually leads to a way you can troubleshoot. Start with the working query and start replacing values with "?" until you get the error. That will tell you which parameter is causing a problem.
 
Mary Taylor
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is only one parameter in both queries; it is set with setString in both cases.

My database tables are corrupted; I'm trying to restore from the output of mysqldump, but I can't seem to get the syntax correct. I will be able to work with the prepared statement problem when I get the database restored.

I'm using MySql 5.0.67.

From the bin directory I issue this command:

mysqld-nt –user=root –p papers < C:\MyProject\SqlQueries\MyProject200905272126.sql

Response is that there are too many parameters for "mysqld-nt". All the examples on the web do this at the command prompt using "mysql", but in 5.0, "mysql' became "mysqld-nt", etc.

Before someone yells at me for working as root, I do plan to create an admin user for this type of thing. Right now I don' t need to do that.



 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
mysqld-nt.exe is the executable for the service, not the command line utility used to enter sql statements. You should be using mysql.exe instead. There was no renaming of mysql to mysqld-nt in MySQL 5, the windows service has always been named mysqld-nt.exe, from what I recall. If you are missing mysql.exe, then I guess you probably unselected the option for the command line utilities during installation.
 
Mary Taylor
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm as red faced as the staff at JavaRanch just said they are while working on their servers; anyway, I
have absolutely no idea what i was thinking because I do have mysql.exe. I need to get some sleep!
Stayed up way too late twice this week working on a project. Very sorry.

I still can't seem to get the syntax of the command correct, but hopefully soon I will.

 
Mary Taylor
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just to let you know that I was able to restore the database tables and both queries worked. It's magic and 3 days work!

Thanks to all of you.
 
Proudly marching to the beat of a different kettle of fish... while reading this tiny ad
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic