472,127 Members | 1,482 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,127 software developers and data experts.

select file using Stored Procedure

I had a doubt in Mysql Stored procedure. i need to read a text file (that is stored in mysql database) using the Stored procedure. i know little bit about the Stored procedure but i am not able to read a file.
Expand|Select|Wrap|Line Numbers
  1. import java.sql.*;  
  2. import java.io.*;  
  3. import java.lang.*; 
  4. import java.util.StringTokenizer; 
  5.      public class test {     
  6.        public static void main(String[] args) {     
  7.      try{        
  8.   Class.forName("com.mysql.jdbc.Driver").newInstance();   
  9.        Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","ttt");     
  10.      Statement st=con.createStatement();   
  11.        String sql="select User_Id, Txt_Resume from Resume where User_Id=2";   
  12.        ResultSet rs=st.executeQuery(sql);  
  13.         while(rs.next()) {       
  14.          StringTokenizer str = new StringTokenizer(rs.getString(2)); 
  15.         while (str.hasMoreTokens()) {      
  16.            String data = str.nextToken();        
  17.    System.out.println("Data: "+data);          }          
  18.     }          System.out.println("Data transfer successfully");  
  19.  } catch(Exception e){e.printStackTrace();
  20.   } 
  21.      }      
  22.   }  
the above java code read the text file and print the word. the same thing i want to do using the mysql StoredProcedure.

give the idea to do my task.

Thank you
Jun 24 '08 #1
0 2225

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by =?Utf-8?B?VGVycnk=?= | last post: by
5 posts views Thread by Chris Cowles | last post: by
reply views Thread by Richard Silvers | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.