creating files with "outfile..." (file can't found!)

Thread Solved

Join Date: Sep 2009
Posts: 105
Reputation: jrosh is an unknown quantity at this point 
Solved Threads: 0
jrosh jrosh is offline Offline
Junior Poster

creating files with "outfile..." (file can't found!)

 
0
  #1
23 Days Ago
I did this ..


  1.  
  2. String filename = "tempoutfile.txt";
  3. String tablename = "table1";
  4.  
  5. try{
  6.  
  7.  
  8.  
  9. Connection con = DriverManager.getConnection("jdbc:mysql://localhost/Test","root","");
  10. Statement s=con.createStatement();
  11. ResultSet r=s.executeQuery("SELECT * INTO OUTFILE '"+ filename + "' FROM " + tablename);
  12.  
  13.  
  14.  
  15.  
  16.  
  17. }catch(SQLException se){System.out.println(se.getMessage());}


But I can't find the file that is created!!

When I run the query in WAMP mysql console , it creates the out file in wamp\mysql\data . But not in previous case.

Where is this file created?
Last edited by jrosh; 23 Days Ago at 1:14 am.
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 2,357
Reputation: masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of 
Solved Threads: 252
Moderator
masijade's Avatar
masijade masijade is offline Offline
Nearly a Posting Maven
 
0
  #2
23 Days Ago
Add a System.out.println(System.getProperty("user.dir")) in there.

Otherwise use the search function for the OS.

But, the best way is to provide the full path to the file from the beginning. Why simply deal with defaults that can change due to configuration and/or operating parameters when you can control the operation.
Java Programmer and Sun Systems Administrator

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

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Java Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC