org.vrforcad
Class ConnectToMySQL

java.lang.Object
  extended by org.vrforcad.ConnectToMySQL

public class ConnectToMySQL
extends java.lang.Object

This class perform the Mysql Connection.

Version:
1.2
Author:
Daniel Cioi

Constructor Summary
ConnectToMySQL()
           
 
Method Summary
 void connect(java.lang.String fileFormat, java.lang.String typeQuery)
          Connect to MySQL database.
 void getFile(int id)
          Get the file from id.
 void queryGetFile(java.lang.String table, int id)
          Get the selected file and download it local in temp folder.
 void queryUploadFile(java.lang.String table)
          Upload the file to database.
static long readFromBlob(java.sql.Blob blob, java.io.OutputStream out)
          Read from BLOB file type in database
 void writeToDatabase(java.lang.String fileFormat, java.lang.String fileName, java.lang.String userName, java.lang.String description)
          Upload the file to database.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConnectToMySQL

public ConnectToMySQL()
Method Detail

connect

public void connect(java.lang.String fileFormat,
                    java.lang.String typeQuery)
Connect to MySQL database.

Parameters:
fileFormat - file extension
typeQuery - select, dFile (download file), uFile (upload file)

getFile

public void getFile(int id)
Get the file from id.

Parameters:
id - id number

queryGetFile

public void queryGetFile(java.lang.String table,
                         int id)
Get the selected file and download it local in temp folder.

Parameters:
table -
id -

readFromBlob

public static long readFromBlob(java.sql.Blob blob,
                                java.io.OutputStream out)
                         throws java.sql.SQLException,
                                java.io.IOException
Read from BLOB file type in database

Throws:
java.sql.SQLException
java.io.IOException

writeToDatabase

public void writeToDatabase(java.lang.String fileFormat,
                            java.lang.String fileName,
                            java.lang.String userName,
                            java.lang.String description)
Upload the file to database.

Parameters:
fileFormat - the file extension
fileName - the file name
userName - the user name who send the file tot database
description - few words about the file (description)

queryUploadFile

public void queryUploadFile(java.lang.String table)
Upload the file to database.

Parameters:
table - in which table must upload the file