943,973 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Marked Solved
  • Views: 471
  • Java RSS
Nov 4th, 2009
0

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

Expand Post »
I did this ..


Java Syntax (Toggle Plain Text)
  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; Nov 4th, 2009 at 1:14 am.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Junior Poster
jrosh is offline Offline
141 posts
since Sep 2009
Nov 4th, 2009
0
Re: creating files with "outfile..." (file can't found!)
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.
Moderator
Reputation Points: 1471
Solved Threads: 490
Industrious Poster
masijade is offline Offline
4,043 posts
since Feb 2006

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: scroll text with many link
Next Thread in Java Forum Timeline: Java Software Help





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC