Converted database connections to use JNDI naming over DriverManager connections. So LexConstantsSecure.java is no longer needed.
This commit is contained in:
parent
ee70f862c9
commit
c532303425
2 changed files with 216 additions and 64 deletions
|
@ -4,86 +4,225 @@ package org.thdl.lex;
|
||||||
/**
|
/**
|
||||||
* Description of the Class
|
* Description of the Class
|
||||||
*
|
*
|
||||||
*@author travis
|
* @author travis
|
||||||
*@created October 1, 2003
|
* @created October 1, 2003
|
||||||
*/
|
*/
|
||||||
public class LexConstants
|
public class LexConstants
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* REQUEST PARAM/ATTR NAMES AND VALUES USED BY LexComponentFilter.java
|
REQUEST PARAM/ATTR NAMES AND VALUES USED BY LexComponentFilter.java
|
||||||
|
*/
|
||||||
|
//form field req params
|
||||||
|
/**
|
||||||
|
* Description of the Field
|
||||||
*/
|
*/
|
||||||
//form field req params
|
|
||||||
public final static String LABEL_REQ_PARAM = "comp";
|
public final static String LABEL_REQ_PARAM = "comp";
|
||||||
|
/**
|
||||||
|
* Description of the Field
|
||||||
|
*/
|
||||||
public final static String TERMLABEL_VALUE = "term";
|
public final static String TERMLABEL_VALUE = "term";
|
||||||
|
/**
|
||||||
|
* Description of the Field
|
||||||
|
*/
|
||||||
public final static String PRONUNCIATIONLABEL_VALUE = "pronunciation";
|
public final static String PRONUNCIATIONLABEL_VALUE = "pronunciation";
|
||||||
|
/**
|
||||||
|
* Description of the Field
|
||||||
|
*/
|
||||||
public final static String SPELLINGLABEL_VALUE = "spelling";
|
public final static String SPELLINGLABEL_VALUE = "spelling";
|
||||||
|
/**
|
||||||
|
* Description of the Field
|
||||||
|
*/
|
||||||
public final static String ETYMOLOGYLABEL_VALUE = "etymology";
|
public final static String ETYMOLOGYLABEL_VALUE = "etymology";
|
||||||
|
/**
|
||||||
|
* Description of the Field
|
||||||
|
*/
|
||||||
public final static String FUNCTIONLABEL_VALUE = "function";
|
public final static String FUNCTIONLABEL_VALUE = "function";
|
||||||
|
/**
|
||||||
|
* Description of the Field
|
||||||
|
*/
|
||||||
public final static String ENCYCLOPEDIA_ARTICLE_LABEL_VALUE = "encyclopediaArticle";
|
public final static String ENCYCLOPEDIA_ARTICLE_LABEL_VALUE = "encyclopediaArticle";
|
||||||
|
/**
|
||||||
|
* Description of the Field
|
||||||
|
*/
|
||||||
public final static String DEFINITIONLABEL_VALUE = "definition";
|
public final static String DEFINITIONLABEL_VALUE = "definition";
|
||||||
|
/**
|
||||||
|
* Description of the Field
|
||||||
|
*/
|
||||||
public final static String SUBDEFINITIONLABEL_VALUE = "subdefinition";
|
public final static String SUBDEFINITIONLABEL_VALUE = "subdefinition";
|
||||||
|
/**
|
||||||
|
* Description of the Field
|
||||||
|
*/
|
||||||
public final static String MODELSENTENCELABEL_VALUE = "modelSentence";
|
public final static String MODELSENTENCELABEL_VALUE = "modelSentence";
|
||||||
|
/**
|
||||||
|
* Description of the Field
|
||||||
|
*/
|
||||||
public final static String PASSAGELABEL_VALUE = "passage";
|
public final static String PASSAGELABEL_VALUE = "passage";
|
||||||
|
/**
|
||||||
|
* Description of the Field
|
||||||
|
*/
|
||||||
public final static String TRANSLATIONLABEL_VALUE = "translationEquivalent";
|
public final static String TRANSLATIONLABEL_VALUE = "translationEquivalent";
|
||||||
|
/**
|
||||||
|
* Description of the Field
|
||||||
|
*/
|
||||||
public final static String RELATEDTERMLABEL_VALUE = "relatedTerm";
|
public final static String RELATEDTERMLABEL_VALUE = "relatedTerm";
|
||||||
|
/**
|
||||||
|
* Description of the Field
|
||||||
|
*/
|
||||||
public final static String REGISTERLABEL_VALUE = "register";
|
public final static String REGISTERLABEL_VALUE = "register";
|
||||||
|
/**
|
||||||
|
* Description of the Field
|
||||||
|
*/
|
||||||
public final static String KEYWORDLABEL_VALUE = "keyword";
|
public final static String KEYWORDLABEL_VALUE = "keyword";
|
||||||
|
/**
|
||||||
|
* Description of the Field
|
||||||
|
*/
|
||||||
public final static String PREFERENCESLABEL_VALUE = "preferences";
|
public final static String PREFERENCESLABEL_VALUE = "preferences";
|
||||||
|
/**
|
||||||
|
* Description of the Field
|
||||||
|
*/
|
||||||
public final static String ANALYTICALNOTELABEL_VALUE = "analyticalNote";
|
public final static String ANALYTICALNOTELABEL_VALUE = "analyticalNote";
|
||||||
/*
|
/*
|
||||||
* REQUEST PARAM NAMES AND VALUES USED BY LexActionServlet.java
|
REQUEST PARAM NAMES AND VALUES USED BY LexActionServlet.java
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* Description of the Field
|
||||||
*/
|
*/
|
||||||
public final static String COMMAND_REQ_PARAM = "cmd";
|
public final static String COMMAND_REQ_PARAM = "cmd";
|
||||||
/*
|
/*
|
||||||
* REQUEST PARAM NAMES AND VALUES USED BY LoginServlet.java
|
REQUEST PARAM NAMES AND VALUES USED BY LoginServlet.java
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* Description of the Field
|
||||||
*/
|
*/
|
||||||
public final static String USERNAME_REQ_PARAM = "username";
|
public final static String USERNAME_REQ_PARAM = "username";
|
||||||
|
/**
|
||||||
|
* Description of the Field
|
||||||
|
*/
|
||||||
public final static String PASSWORD_REQ_PARAM = "password";
|
public final static String PASSWORD_REQ_PARAM = "password";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* --------------------------
|
--------------------------
|
||||||
* REQUEST PARAM NAMES USED BY LexComponent.scrapeRequest(req) METHODS
|
REQUEST PARAM NAMES USED BY LexComponent.scrapeRequest(req) METHODS
|
||||||
* --------------------------
|
--------------------------
|
||||||
|
*/
|
||||||
|
//Meta Data Request Params
|
||||||
|
/**
|
||||||
|
* Description of the Field
|
||||||
*/
|
*/
|
||||||
//Meta Data Request Params
|
|
||||||
public final static String NOTE_REQ_PARAM = "note";
|
public final static String NOTE_REQ_PARAM = "note";
|
||||||
|
/**
|
||||||
|
* Description of the Field
|
||||||
|
*/
|
||||||
public final static String LANGUAGE_REQ_PARAM = "language";
|
public final static String LANGUAGE_REQ_PARAM = "language";
|
||||||
|
/**
|
||||||
|
* Description of the Field
|
||||||
|
*/
|
||||||
public final static String TRANSLATIONOF_REQ_PARAM = "translationOf";
|
public final static String TRANSLATIONOF_REQ_PARAM = "translationOf";
|
||||||
|
/**
|
||||||
|
* Description of the Field
|
||||||
|
*/
|
||||||
public final static String DIALECT_REQ_PARAM = "dialect";
|
public final static String DIALECT_REQ_PARAM = "dialect";
|
||||||
|
/**
|
||||||
|
* Description of the Field
|
||||||
|
*/
|
||||||
public final static String SOURCE_REQ_PARAM = "source";
|
public final static String SOURCE_REQ_PARAM = "source";
|
||||||
|
/**
|
||||||
|
* Description of the Field
|
||||||
|
*/
|
||||||
public final static String PROJSUB_REQ_PARAM = "projectSubject";
|
public final static String PROJSUB_REQ_PARAM = "projectSubject";
|
||||||
|
/**
|
||||||
|
* Description of the Field
|
||||||
|
*/
|
||||||
public final static String SCRIPT_REQ_PARAM = "script";
|
public final static String SCRIPT_REQ_PARAM = "script";
|
||||||
//Term Data Request Params
|
//Term Data Request Params
|
||||||
|
/**
|
||||||
|
* Description of the Field
|
||||||
|
*/
|
||||||
public final static String TERM_REQ_PARAM = "term";
|
public final static String TERM_REQ_PARAM = "term";
|
||||||
|
/**
|
||||||
|
* Description of the Field
|
||||||
|
*/
|
||||||
public final static String TERMID_REQ_PARAM = "termId";
|
public final static String TERMID_REQ_PARAM = "termId";
|
||||||
// public static final String SPELLINGNOTE_REQ_PARAM = "spellingNote";
|
// public static final String SPELLINGNOTE_REQ_PARAM = "spellingNote";
|
||||||
|
/**
|
||||||
|
* Description of the Field
|
||||||
|
*/
|
||||||
public final static String PRECEDENCE_REQ_PARAM = "precedence";
|
public final static String PRECEDENCE_REQ_PARAM = "precedence";
|
||||||
//Definition Data Request Params
|
//Definition Data Request Params
|
||||||
|
/**
|
||||||
|
* Description of the Field
|
||||||
|
*/
|
||||||
public final static String SUBDEFINITION_REQ_PARAM = "subdefinition";
|
public final static String SUBDEFINITION_REQ_PARAM = "subdefinition";
|
||||||
|
|
||||||
//outgoing request attributes to jsp
|
//outgoing request attributes to jsp
|
||||||
|
/**
|
||||||
|
* Description of the Field
|
||||||
|
*/
|
||||||
public final static String COMPONENT_REQ_ATTR = "component";
|
public final static String COMPONENT_REQ_ATTR = "component";
|
||||||
|
/**
|
||||||
|
* Description of the Field
|
||||||
|
*/
|
||||||
public final static String ORIGINALBEAN_REQ_ATTR = "original";
|
public final static String ORIGINALBEAN_REQ_ATTR = "original";
|
||||||
|
/**
|
||||||
|
* Description of the Field
|
||||||
|
*/
|
||||||
public final static String MESSAGE_REQ_ATTR = "message";
|
public final static String MESSAGE_REQ_ATTR = "message";
|
||||||
|
|
||||||
//session attributes used by filters, servlet, commands and jsp
|
//session attributes used by filters, servlet, commands and jsp
|
||||||
|
/**
|
||||||
|
* Description of the Field
|
||||||
|
*/
|
||||||
public final static String USER_SESS_ATTR = "user";
|
public final static String USER_SESS_ATTR = "user";
|
||||||
|
/**
|
||||||
|
* Description of the Field
|
||||||
|
*/
|
||||||
public final static String PREFERENCES_SESS_ATTR = "preferences";
|
public final static String PREFERENCES_SESS_ATTR = "preferences";
|
||||||
|
/**
|
||||||
|
* Description of the Field
|
||||||
|
*/
|
||||||
public final static String LOGINTARGET_SESS_PARAM = "loginTarget";
|
public final static String LOGINTARGET_SESS_PARAM = "loginTarget";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description of the Field
|
||||||
|
*/
|
||||||
public final static String DISPLAYMODE_SESS_ATTR = "displayMode";
|
public final static String DISPLAYMODE_SESS_ATTR = "displayMode";
|
||||||
|
/**
|
||||||
|
* Description of the Field
|
||||||
|
*/
|
||||||
public final static String QUERY_SESS_ATTR = "query";
|
public final static String QUERY_SESS_ATTR = "query";
|
||||||
|
/**
|
||||||
|
* Description of the Field
|
||||||
|
*/
|
||||||
public final static String TERMENTRYBEAN_SESS_ATTR = "termEntry";
|
public final static String TERMENTRYBEAN_SESS_ATTR = "termEntry";
|
||||||
|
|
||||||
//used by Servlet
|
//used by Servlet
|
||||||
|
/**
|
||||||
|
* Description of the Field
|
||||||
|
*/
|
||||||
public final static String JSP_DIR = "/jsp/";
|
public final static String JSP_DIR = "/jsp/";
|
||||||
|
/**
|
||||||
|
* Description of the Field
|
||||||
|
*/
|
||||||
public final static String WELCOME_PAGE = "action?cmd=menu";
|
public final static String WELCOME_PAGE = "action?cmd=menu";
|
||||||
|
/**
|
||||||
|
* Description of the Field
|
||||||
|
*/
|
||||||
public final static String ERROR_PAGE = "error.jsp";
|
public final static String ERROR_PAGE = "error.jsp";
|
||||||
//used by Repository
|
//used by Repository
|
||||||
|
/**
|
||||||
|
* Description of the Field
|
||||||
|
*/
|
||||||
public final static String DRIVER = "com.mysql.jdbc.Driver";
|
public final static String DRIVER = "com.mysql.jdbc.Driver";
|
||||||
|
/**
|
||||||
|
* Description of the Field
|
||||||
|
*/
|
||||||
|
public final static String DATASOURCE_NAME = "java:comp/env/jdbc/lex-datasource";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description of the Field
|
||||||
|
*/
|
||||||
public final static String HIBERNATE_SESSION_KEY = "hib";
|
public final static String HIBERNATE_SESSION_KEY = "hib";
|
||||||
|
|
||||||
//public final static String URL = "jdbc:mysql://localhost/LexTorque";
|
//public final static String URL = "jdbc:mysql://localhost/LexTorque";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,16 @@
|
||||||
package org.thdl.lex;
|
package org.thdl.lex;
|
||||||
|
import java.sql.*;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.sql.*;
|
import javax.naming.*;
|
||||||
|
import javax.sql.*;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description of the Class
|
* Description of the Class
|
||||||
*
|
*
|
||||||
*@author travis
|
* @author travis
|
||||||
*@created September 26, 2002
|
* @created September 26, 2002
|
||||||
*/
|
*/
|
||||||
public class LexRepository
|
public class LexRepository
|
||||||
{
|
{
|
||||||
|
@ -25,8 +27,8 @@ public class LexRepository
|
||||||
/**
|
/**
|
||||||
* Sets the connection attribute of the LexRepository object
|
* Sets the connection attribute of the LexRepository object
|
||||||
*
|
*
|
||||||
*@param connection The new connection value
|
* @param connection The new connection value
|
||||||
*@since
|
* @since
|
||||||
*/
|
*/
|
||||||
private void setConnection( Connection connection )
|
private void setConnection( Connection connection )
|
||||||
{
|
{
|
||||||
|
@ -37,8 +39,8 @@ public class LexRepository
|
||||||
/**
|
/**
|
||||||
* Sets the queryStatement attribute of the LexRepository object
|
* Sets the queryStatement attribute of the LexRepository object
|
||||||
*
|
*
|
||||||
*@param queryStatement The new queryStatement value
|
* @param queryStatement The new queryStatement value
|
||||||
*@since
|
* @since
|
||||||
*/
|
*/
|
||||||
public void setQueryStatement( Statement queryStatement )
|
public void setQueryStatement( Statement queryStatement )
|
||||||
{
|
{
|
||||||
|
@ -49,8 +51,8 @@ public class LexRepository
|
||||||
/**
|
/**
|
||||||
* Sets the updateStatement attribute of the LexRepository object
|
* Sets the updateStatement attribute of the LexRepository object
|
||||||
*
|
*
|
||||||
*@param updateStatement The new updateStatement value
|
* @param updateStatement The new updateStatement value
|
||||||
*@since
|
* @since
|
||||||
*/
|
*/
|
||||||
public void setUpdateStatement( Statement updateStatement )
|
public void setUpdateStatement( Statement updateStatement )
|
||||||
{
|
{
|
||||||
|
@ -61,9 +63,9 @@ public class LexRepository
|
||||||
/**
|
/**
|
||||||
* Gets the instance attribute of the LexRepository class
|
* Gets the instance attribute of the LexRepository class
|
||||||
*
|
*
|
||||||
*@return The instance value
|
* @return The instance value
|
||||||
*@exception LexRepositoryException Description of the Exception
|
* @exception LexRepositoryException Description of the Exception
|
||||||
*@since
|
* @since
|
||||||
*/
|
*/
|
||||||
public static LexRepository getInstance() throws LexRepositoryException
|
public static LexRepository getInstance() throws LexRepositoryException
|
||||||
{
|
{
|
||||||
|
@ -78,8 +80,8 @@ public class LexRepository
|
||||||
/**
|
/**
|
||||||
* Gets the connection attribute of the LexRepository object
|
* Gets the connection attribute of the LexRepository object
|
||||||
*
|
*
|
||||||
*@return The connection value
|
* @return The connection value
|
||||||
*@since
|
* @since
|
||||||
*/
|
*/
|
||||||
private Connection getConnection()
|
private Connection getConnection()
|
||||||
{
|
{
|
||||||
|
@ -90,8 +92,8 @@ public class LexRepository
|
||||||
/**
|
/**
|
||||||
* Gets the queryStatement attribute of the LexRepository object
|
* Gets the queryStatement attribute of the LexRepository object
|
||||||
*
|
*
|
||||||
*@return The queryStatement value
|
* @return The queryStatement value
|
||||||
*@since
|
* @since
|
||||||
*/
|
*/
|
||||||
public Statement getQueryStatement()
|
public Statement getQueryStatement()
|
||||||
{
|
{
|
||||||
|
@ -102,8 +104,8 @@ public class LexRepository
|
||||||
/**
|
/**
|
||||||
* Gets the updateStatement attribute of the LexRepository object
|
* Gets the updateStatement attribute of the LexRepository object
|
||||||
*
|
*
|
||||||
*@return The updateStatement value
|
* @return The updateStatement value
|
||||||
*@since
|
* @since
|
||||||
*/
|
*/
|
||||||
public Statement getUpdateStatement()
|
public Statement getUpdateStatement()
|
||||||
{
|
{
|
||||||
|
@ -115,11 +117,11 @@ public class LexRepository
|
||||||
/**
|
/**
|
||||||
* doQuery() performs a SELECT query on the database.
|
* doQuery() performs a SELECT query on the database.
|
||||||
*
|
*
|
||||||
*@param sql This is a SQL String passed in from
|
* @param sql This is a SQL String passed in from
|
||||||
* outside.
|
* outside.
|
||||||
*@return ResultSet representing query results
|
* @return ResultSet representing query results
|
||||||
*@exception LexRepositoryException Description of the Exception
|
* @exception LexRepositoryException Description of the Exception
|
||||||
*@since
|
* @since
|
||||||
*/
|
*/
|
||||||
public ResultSet doQuery( String sql ) throws LexRepositoryException
|
public ResultSet doQuery( String sql ) throws LexRepositoryException
|
||||||
{
|
{
|
||||||
|
@ -129,7 +131,7 @@ public class LexRepository
|
||||||
}
|
}
|
||||||
catch ( SQLException sqle )
|
catch ( SQLException sqle )
|
||||||
{
|
{
|
||||||
throw new LexRepositoryException( sqle.getMessage() );
|
throw new LexRepositoryException( sqle );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,10 +139,10 @@ public class LexRepository
|
||||||
/**
|
/**
|
||||||
* doUpdate() performs an INSERT/UPDATE/DROP action
|
* doUpdate() performs an INSERT/UPDATE/DROP action
|
||||||
*
|
*
|
||||||
*@param sql Description of the Parameter
|
* @param sql Description of the Parameter
|
||||||
*@return Description of the Return Value
|
* @return Description of the Return Value
|
||||||
*@exception LexRepositoryException Description of the Exception
|
* @exception LexRepositoryException Description of the Exception
|
||||||
*@since
|
* @since
|
||||||
*/
|
*/
|
||||||
public int doUpdate( String sql ) throws LexRepositoryException
|
public int doUpdate( String sql ) throws LexRepositoryException
|
||||||
{
|
{
|
||||||
|
@ -150,7 +152,7 @@ public class LexRepository
|
||||||
}
|
}
|
||||||
catch ( SQLException sqle )
|
catch ( SQLException sqle )
|
||||||
{
|
{
|
||||||
throw new LexRepositoryException( sqle.getMessage() );
|
throw new LexRepositoryException( sqle );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,10 +161,10 @@ public class LexRepository
|
||||||
* doInsert() is a wrapper for doUpdate() that returns the auto_increment
|
* doInsert() is a wrapper for doUpdate() that returns the auto_increment
|
||||||
* primary key value of the newly inserted row
|
* primary key value of the newly inserted row
|
||||||
*
|
*
|
||||||
*@param sql Description of the Parameter
|
* @param sql Description of the Parameter
|
||||||
*@return Description of the Return Value
|
* @return Description of the Return Value
|
||||||
*@exception LexRepositoryException Description of the Exception
|
* @exception LexRepositoryException Description of the Exception
|
||||||
*@since
|
* @since
|
||||||
*/
|
*/
|
||||||
public int doInsert( String sql ) throws LexRepositoryException
|
public int doInsert( String sql ) throws LexRepositoryException
|
||||||
{
|
{
|
||||||
|
@ -197,7 +199,7 @@ public class LexRepository
|
||||||
}
|
}
|
||||||
catch ( SQLException sqle )
|
catch ( SQLException sqle )
|
||||||
{
|
{
|
||||||
throw new LexRepositoryException( sqle.getMessage() );
|
throw new LexRepositoryException( sqle );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,8 +209,8 @@ public class LexRepository
|
||||||
* The main program for the LexRepository class. This method tests all other
|
* The main program for the LexRepository class. This method tests all other
|
||||||
* methods in this class
|
* methods in this class
|
||||||
*
|
*
|
||||||
*@param args The command line arguments
|
* @param args The command line arguments
|
||||||
*@since
|
* @since
|
||||||
*/
|
*/
|
||||||
public static void main( String[] args )
|
public static void main( String[] args )
|
||||||
{
|
{
|
||||||
|
@ -218,7 +220,7 @@ public class LexRepository
|
||||||
{
|
{
|
||||||
msg = args[0];
|
msg = args[0];
|
||||||
}
|
}
|
||||||
//TEST doInsert() method. Insert a message multiple times using the Testing table
|
//TEST doInsert() method. Insert a message multiple times using the Testing table
|
||||||
System.out.println( "TEST ONE\n--------\n" );
|
System.out.println( "TEST ONE\n--------\n" );
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -240,8 +242,8 @@ public class LexRepository
|
||||||
lre.printStackTrace();
|
lre.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
//TEST doQuery() method. Accept a table parameter from the command line and output
|
//TEST doQuery() method. Accept a table parameter from the command line and output
|
||||||
//a tab-delimited representation of the table.
|
//a tab-delimited representation of the table.
|
||||||
System.out.println( "\nTEST TWO\n--------\n" );
|
System.out.println( "\nTEST TWO\n--------\n" );
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -293,30 +295,41 @@ public class LexRepository
|
||||||
/**
|
/**
|
||||||
* Default Constructor for the LexRepository object
|
* Default Constructor for the LexRepository object
|
||||||
*
|
*
|
||||||
*@exception LexRepositoryException Description of the Exception
|
* @exception LexRepositoryException Description of the Exception
|
||||||
*@since
|
* @since
|
||||||
*/
|
*/
|
||||||
private LexRepository() throws LexRepositoryException
|
private LexRepository() throws LexRepositoryException
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Class.forName( LexConstants.DRIVER );
|
/*
|
||||||
Properties props = new Properties();
|
Class.forName( LexConstants.DRIVER );
|
||||||
props.setProperty( "user", LexConstantsSecure.USER );
|
Properties props = new Properties();
|
||||||
props.setProperty( "password", LexConstantsSecure.PASSWORD );
|
props.setProperty( "user", LexConstantsSecure.USER );
|
||||||
props.setProperty( "useUnicode", "true" );
|
props.setProperty( "password", LexConstantsSecure.PASSWORD );
|
||||||
props.setProperty( "characterEncoding", "UTF-8" );
|
props.setProperty( "useUnicode", "true" );
|
||||||
setConnection( DriverManager.getConnection( LexConstantsSecure.URL, props ) );
|
props.setProperty( "characterEncoding", "UTF-8" );
|
||||||
|
setConnection( DriverManager.getConnection( LexConstantsSecure.URL, props ) );
|
||||||
|
*/
|
||||||
|
Context context = new InitialContext();
|
||||||
|
DataSource source = (DataSource) context.lookup( LexConstants.DATASOURCE_NAME );
|
||||||
|
setConnection( source.getConnection() );
|
||||||
setQueryStatement( getConnection().createStatement() );
|
setQueryStatement( getConnection().createStatement() );
|
||||||
setUpdateStatement( getConnection().createStatement() );
|
setUpdateStatement( getConnection().createStatement() );
|
||||||
}
|
}
|
||||||
catch ( ClassNotFoundException cnfe )
|
/*
|
||||||
|
catch ( ClassNotFoundException cnfe )
|
||||||
|
{
|
||||||
|
throw new LexRepositoryException( "No Driver Available for: " + LexConstants.DRIVER );
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
catch ( NamingException ne )
|
||||||
{
|
{
|
||||||
throw new LexRepositoryException( "No Driver Available for: " + LexConstants.DRIVER );
|
throw new LexRepositoryException( ne );
|
||||||
}
|
}
|
||||||
catch ( SQLException se )
|
catch ( SQLException se )
|
||||||
{
|
{
|
||||||
throw new LexRepositoryException( se.getMessage() );
|
throw new LexRepositoryException( se );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue