Hi,
I tried to implement the org.apache.turbine.util.db.pool.DBSybase class so that
I can use Turbine with Sybase.
I added the following:
public static final int DB_SYBASE = 8;
public static final String DRIVER_SYBASE = "com.sybase.jdbc.SybDriver";
to DB.java under package: org.apache.turbine.util.db.pool.
here is the code of DBSybase.java:
package org.apache.turbine.util.db.pool;
public class DBSybase implements DB
{
private static final int DATABASE_TYPE = DB.DB_SYBASE;
private String url = null;
private String username= null;
private String password= null;
protected DBSybase()
{
}
public Connection getConnection() throws SQLException
{
return DriverManager.getConnection(url, username, password);
}
public void init(String url, String username, String password) throws
Exception
{
this.url = url;
this.username = username;
this.password = password;
Class.forName( DRIVER_SYBASE ).newInstance();
}
public int getDatabaseType()
{
return this.DATABASE_TYPE;
}
/** This method is used to ignore case */
public String toUpperCase(String in)
{
return new StringBuffer("UPPER(").append(in).append(")").toString();
}
public char getStringDelimiter()
{
return '\''; // '
}
public String getIdSqlForAutoIncrement()
{
return null;
}
public String getSequenceSql(Object sequenceName)
{
return null;
}
/**
* The method is used to lock a table.
*/
public void lockTable(Connection con, String table) throws SQLException
{
Statement statement = con.createStatement();
StringBuffer stmt = new StringBuffer();
stmt.append( "SELECT next_id FROM " )
.append( table )
.append( " FOR UPDATE" );
statement.executeQuery( stmt.toString() );
}
/**
* The method is used to unlock a table.
*/
public void unlockTable(Connection con, String table) throws SQLException
{
// tables in Oracle are unlocked when a commit is issued
// the user may have issued a commit but do it here
// to be sure
con.commit();
}
}
this compiles fine....but when I click on Login, tomcat threw the following
exception:
java.lang.Error: Error in BasePeer.initTableSchema(): ZZ00A: The method
getTableName has not been completed and should not be called.
at
org.apache.turbine.om.peer.BasePeer.initTableSchema(BasePeer.java:221)
at
org.apache.turbine.om.user.peer.TurbineUserPeer.<clinit>(TurbineUserPeer.java:145)
at
org.apache.turbine.om.user.TurbineUser.retrieveFromStorage(TurbineUser.java:310)
at
org.apache.turbine.om.user.peer.UserFactory.getUser(UserFactory.java:108)
at
org.apache.turbine.om.user.peer.UserFactory.getUser(UserFactory.java:83)
at
org.apache.turbine.modules.actions.LoginUser.build(LoginUser.java:101)
at org.apache.turbine.modules.ActionLoader.exec(ActionLoader.java:115)
at Turbine.doGet(Turbine.java:261)
at Turbine.doPost(Turbine.java:382)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:772)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
at
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:390)
at
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:422)
at
org.apache.tomcat.servlets.InvokerServlet.service(InvokerServlet.java:257)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
at
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:390)
at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:513)
at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:146)
at
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:334)
at java.lang.Thread.run(Thread.java:479)
what I am doing wrong?
Thanks,
--hqn
__________________________________________
NetZero - Defenders of the Free World
Get your FREE Internet Access and Email at
http://www.netzero.net/download/index.html
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]