File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Qusetion for a project please help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Qusetion for a project please help" Watch "Qusetion for a project please help" New topic

Qusetion for a project please help

menwa ms

Joined: Nov 14, 2003
Posts: 12
hi ...
i have this application that has a text field(voice) in which you enter the path of the .au file and it will be added in the database, and i also have asearch button that will search for that .au file with the info related to it but i get the unicode of the path(.au file)when i do the search which i don't want .. i want to get the path itself because when i get the unicode i can't play the .au file.(the field in the database that stores the .au files is of type text)..what i mean by unicode is for example when i enter c:\java\ i get 00EEFDCDDFCEE0DDC of the path )
can some one tell me where the error is?
how to correct the error?
if(vname.getText().equals("")|| vaddress.getText().equals("")|| vphone.getText().equals("")|| vsex.getText().equals("")|| vdob.getText().equals("")|| vtemplate.getText().equals("")|| vvoice.getText().equals(""))
JOptionPane.showMessageDialog(null, "Please fill in all the fields","Missing Fields",JOptionPane.INFORMATION_MESSAGE);
// save the new customer:
//1. take the customer's data:
int vuserId = Integer.parseInt(vid.getText());
String vuserName = vname.getText();
String vuserAddress = vaddress.getText();
String vuserPhone = vphone.getText();
String vuserSex = vsex.getText();
String vuserDateBirth = vdob.getText();
String vuserTemplate = vtemplate.getText();
String vuserVoice=vvoice.getText();
File file = new File(vuserVoice);
int fileLength = (int)file.length();
if(fileLength > 0)
fis = new FileInputStream(file);
String query = " INSERT INTO voice VALUES('"+vuserId+"', '"+vuserName+"', '"+vuserAddress+"', '"+vuserPhone+"', '"+vuserSex+"', '"+vuserDateBirth+"', '"+vuserTemplate+"', ? ) ";
PreparedStatement pstmt = conn.prepareStatement(query);
pstmt.setBinaryStream(1, fis, fileLength);
String query = " INSERT INTO voice VALUES('"+vuserId+"', '"+vuserName+"', '"+vuserAddress+"', '"+vuserPhone+"', '"+vuserSex+"', '"+vuserDateBirth+"', '"+vuserTemplate+"',?) ";

/*String query = " INSERT INTO voice VALUES('"+vuserId+"', '"+vuserName+"', '"+vuserAddress+"', '"+vuserPhone+"', '"+vuserSex+"', '"+vuserDateBirth+"', '"+vuserTemplate+"', '"+vuserVoice+"') ";
} //try
catch (Exception ev)
System.out.println("Caught exception in add action: " + ev);
} //catch
and this is the code for the search:
if(e.getSource() == vsearch)
String vuserId = vid.getText();
ResultSet adresults = stat.executeQuery("SELECT * FROM voice WHERE id = '"+vuserId+"' ");
catch(Exception vs)
System.out.println("Caught vdsearch exception: "+vs);
please help..
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
Note that this is a duplicated post. The conversation is being continued over in the JDBC forum...

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
I agree. Here's the link:
subject: Qusetion for a project please help
jQuery in Action, 3rd edition