Re: JDBC and outfile/infile



Mike wrote:
I have MySQL and want to dump the contents of a table into a text file
then read it back in. Can that be done with JDBC? is each a Query or
Update?


--------------------- tried ----------------------------

sql="select * into outfile '/tmp/foo.txt' from foo";
	
rset = stmt.executeQuery(sql);

--------------------- also  ---------------------------

sql="load data infile '/tmp/foo.txt' into table foo";

int rows = stmt.executeUpdate(sql);


-----------------------------------------------------


where foo is the table.


Thanks

Does this help.

The SELECT ... INTO OUTFILE 'file_name' form of SELECT writes the selected rows to a file. The file is created on the server host, so you must have the *FILE privilege* to use this syntax. file_name cannot be an existing file

--


Thanks in Advance...
IchBin, Pocono Lake, Pa, USA http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________


'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor,  Regular Guy (1952-)
.



Relevant Pages

  • Re: Automatic File Relocation Governing Rules
    ... I genuinely couldn't find anything directly related to this query. ... I'm inexprienced in the correct searching techniques. ... "Mike Williams " wrote: ... This is frustrating! ...
    (microsoft.public.windowsmedia.player)
  • Re: why excute query through JDBC much slow than query analyzer?
    ... why excute query through JDBC much slow than query analyzer? ... The SendStringParametersAsUnicode is a connection string attribute that is ... If you capture the Execution Plan in a SQL Profiler trace while executing ...
    (microsoft.public.sqlserver.jdbcdriver)
  • RE: Sort unbonded combo box data
    ... Mike I need to do this programmatically. ... A Query ... Dim strColumnsNames As String ... ' Set the strColumnsNames string as the data source of the combo box ...
    (microsoft.public.access.forms)
  • Re: Setting Query Timeout through JDBC (CA Driver problem?)
    ... I suggest to you not using commands like ""set lockmode ..." ... inside jdbc because they are not intended for being used like that nor ... About query timeout we have not used it, but I do not remember any ...
    (comp.databases.ingres)
  • Re: database toolbox problem
    ... I have found a workaround for this problem. ... This bug is already listed in the Matlab bug reports and ... query = 'ALTER TABLE test ADD test_col VARCHARNOT NULL'; ... "The JDBC spec states that you must either use ...
    (comp.soft-sys.matlab)