Hi,
I have a question related to ODBC Microsoft Access Driver. It gave me the
below error. What I have is an Access Database with has one column
(SelForDistrInSession) of type: Long Integer. My web server is
tomcat3.2.1 running on an NT box.
I was able to query all my data from this database using my java class
(jbdc), I was able to display all the rows, delete a row, however, when I
can not update a row with this Long Integer value, I am getting the error
below. Is is something that ODBC does not support type Long?
Please help, I also include my prepareStatement below.
---------- Log message --------------------------------------
in doPost(...)
userOption == AppletUpdate
Updateing the object
Closing database connection
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]Optional
feature
not implemented
Complete.
----------- SQL prepareStatement ----------------------------
public class PdsToolDataAccessor
{
// data members
// CTL stands for Catalog.
private Connection dbConnection;
private PreparedStatement displayCTLStatement;
private PreparedStatement updateCTLStatement;
private PreparedStatement deleteCTLStatement;
/**
* Constructor that make a database connection and prepares SQL
statements
*/
public PdsToolDataAccessor(String dbDriver, String dbURL, String userID,
String passwd)
{
// use println statements to send status messages to web server
console
try {
log("PdsToolDataAccessor init: Start");
log("PdsToolDataAccessor init: Loading Database Driver: " +
dbDriver);
Class.forName(dbDriver);
log("PdsToolDataAccessor init: Getting a connection to - " +
dbURL);
dbConnection = DriverManager.getConnection(dbURL, userID,
passwd);
log("PdsToolDataAccessor init: Preparing display statement");
displayCTLStatement =
dbConnection.prepareStatement("select * from PdsCatalog order by
PdsName");
log("PdsToolDataAccessor init: Preparing update statement");
updateCTLStatement =
dbConnection.prepareStatement("update PdsCatalog set "
+ "Comments = ? , ProcessName = ?, EffectiveDate = ?,
CreateDat = ?, "
+ ReadyForDistribution = ?, "
+ " InformedSites = ?, CdaComments = ?,
SelForDistrInSession = ? "
+ " where PdsName = ? and NonPdsVer = ?");
log("PdsToolDataAccessor init: Preparing delete statement");
deleteCTLStatement =
dbConnection.prepareStatement("delete * from PdsCatalog where
PdsName= ? and NonPdsVer = ? ");
log("PdsToolDataAccessor init: End");
}
catch (Exception e)
{
cleanUp();
log(e);
}
}
/**
* Closes the database connection
*/
public void cleanUp()
{
try {
log("Closing database connection");
dbConnection.close();
}
catch (SQLException e)
{
log(e);
}
}
/*
* Updates a catalog by inserting them into the database
*/
public void updateCatalog(PdsCatalogBean aCatalog)
{
try {
// set sql parameters
updateCTLStatement.setString(1, aCatalog.getComments());
updateCTLStatement.setString(2, aCatalog.getProcessName());
updateCTLStatement.setDate(3, aCatalog.getEffectiveDate());
updateCTLStatement.setDate(4, aCatalog.getCreateDate());
updateCTLStatement.setString(5,
aCatalog.getReadyForDistribution());
updateCTLStatement.setString(6,
aCatalog.getInformedSites());
updateCTLStatement.setString(7, aCatalog.getCdaComments());
updateCTLStatement.setLong(8,
aCatalog.getSelForDistrInSession().longValue());
updateCTLStatement.setString(9,
aCatalog.getPdsName());
updateCTLStatement.setString(10, aCatalog.getNonPdsVer());
// execute sql
updateCTLStatement.executeUpdate();
}
catch (Exception e)
{
cleanUp();
log(e);
}
}
/**
* Deletes a catalog by removing it into the database
*/
public void deleteCatalog(PdsCatalogBean aCatalog)
{
try {
// set sql parameters
deleteCTLStatement.setString(1, aCatalog.getPdsName());
deleteCTLStatement.setString(2, aCatalog.getNonPdsVer());
// execute sql
deleteCTLStatement.executeUpdate();
}
catch (Exception e)
{
cleanUp();
log(e);
}
}
/**
* Simply closes the database connection
*/
public void destroy()
{
log("PdsToolDataAccessor: destroy");
cleanUp();
}
/**
* Simple method for logging messages to console.
*/
protected void log(Object msg)
{
System.out.println(msg);
}
}
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets