|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttextclassifier.database.MySQLAccess
public class MySQLAccess
Class makes connection to the MySQL database, stores necessary information about it and provides function for running SQL queries.
Field Summary | |
---|---|
java.sql.Connection |
conn
|
Constructor Summary | |
---|---|
MySQLAccess()
|
|
MySQLAccess(java.lang.String server,
java.lang.String db,
java.lang.String user_name,
java.lang.String pass)
Constructor of the class - stores information about database, user etc. |
Method Summary | |
---|---|
java.sql.Connection |
getConnection()
Returns a reference to connection |
boolean |
isConnected()
Finds out if the database connection is established |
boolean |
makeConnection()
Make a new connection - try to make connection to database. |
java.sql.ResultSet |
runSqlCommand(java.lang.String command)
Allows to send an SQL query to the connected MySQL database server |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public java.sql.Connection conn
Constructor Detail |
---|
public MySQLAccess()
public MySQLAccess(java.lang.String server, java.lang.String db, java.lang.String user_name, java.lang.String pass)
server
- URL of MySQL server where the input table is locateddb
- Name of a database on a MySQL serveruser_name
- MySQL Database userpass
- MySQL Database passwordMethod Detail |
---|
public boolean makeConnection()
java.sql.SQLException
- SQL Errorpublic java.sql.Connection getConnection()
public java.sql.ResultSet runSqlCommand(java.lang.String command)
command
- string that contains an SQL command
public boolean isConnected()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |