Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SQL not working

 
colin shuker
Ranch Hand
Posts: 750
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My sql queries don't seem to be working on my war file running on server.

It seems to work locally, but isn't inserting correctly into server, but it seemed to work first time.

Is there anyway I can view a command prompt so I can view all the System.out.println()'s.

But now that I've said that, I guess I could write these to a file on server, and then keep reopening it, after every new page I visit.

That seems simplest, but it might slow things down a bit.

I thought about the logging thing, but don't have a clue how to do it.

Thanks for any advice.
 
Campbell Ritchie
Sheriff
Pie
Posts: 48946
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A lot of DBMSs have command-line interfaces, so you can log on and view things at a command line.
Please supply more details of the problem.
 
Paul Clapham
Sheriff
Posts: 21107
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As for your war file in your server, all of the application servers I'm familiar with redirect System.out to a log file in some way. (The log() method of the servlet class is a more standard way to do this, though.)

As for your idea of writing data to a file and reopening the file and so on, you're in the process of reinventing logging. Don't reinvent it, just use it.
 
Alan Hampson
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
More details would be good.

Some suggestions:

If you can run the war file in either Netbeans or Eclipse, the output of the logging will go to a console window and, as a bonus, you can use the debugger (set break points to stop execution, examine variable values, etc.).

If you can open the log file in an editor; most modern editors will let you refresh the view when the file changes.

Finally, if you are on a Linux/Unix based server, the command tail -f logfile will give you a constant show of what is being written to the file in real time. the PowerShell command gc can be used for this on Windows, or tail commands are available for download.

 
colin shuker
Ranch Hand
Posts: 750
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for suggestions...

The server I use (at itanets.co.uk) is linux based, and I've managed to locate the absolute path of the J2EE console output.

This file can't be accessed when I log into the servers control panel to get into filesystem, or either when I use FTP to get into filesystem,
but I wrote a simple php file which will display the file, and one to clear the file, cause I see it has output going back several months.

So this is much better, but I also use logging in my web-app, such as for closing mysql connection:

I'm not sure where these logs are stored (locally or on web-server). Locally I use glassfish server3, and web-server use apache tomcat I think.
Any thoughts? Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic