Rob Bamforth's Blog
Java, SQL,T-SQL, MySQL, Networking, SQL Server, PHP, COM, DBA, ODBC

Posts Tagged ‘file’

JAVA – JFreeChart – How To Save a JFreeChart to JPEG File

November 5, 2008

 
A quick how to use JFreeChart quide can be found at- http://robbamforth.wordpress.com/2008/10/30/java-jfreechart-graphs-and-charts-in-java/
I wanted to be able to output the the charts to a picture file (JPEG) programatically. After a bit of research I got the following methods to paint the chart and output the image to a file.
Add these 2 methods to the class that creates the charts:
Method [...]

SQL – Output Data from SQL Server To File – BCP

November 3, 2008

The following BCP command selects data from a table called CUSTOMERS in the DATA database and exports it to a file called FOO_REPORT.CSV:

declare @bcpcommand           varchar(1000)
 
SET @bcpcommand = ‘bcp “SELECT id, title, forename, surname, product FROM DATA.dbo.customers where product = ”FOO”” queryout C:\reports\FOO_REPORT.CSV -c -T”‘

EXEC master..xp_cmdshell @bcpcommand

 You can also output to .XLS and .TXT.