File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes SQL not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "SQL not working" Watch "SQL not working" New topic
Author

SQL not working

colin shuker
Ranch Hand

Joined: Apr 11, 2005
Posts: 744
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

Joined: Oct 13, 2005
Posts: 40052
    
  28
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
Bartender

Joined: Oct 14, 2005
Posts: 18991
    
    8

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

Joined: Apr 10, 2009
Posts: 31
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

Joined: Apr 11, 2005
Posts: 744
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
 
jQuery in Action, 2nd edition
 
subject: SQL not working