Connecting to database using struts
843836Jun 9 2005 — edited Jul 11 2008i'm trying to connect to an Access database locally but im having trouble setting up my data-sources. can anyone tell me if this is the proper syntax in struts-config.xml for doing such a thing...
<data-source
type="org.apache.commons.dbcp.BasicDataSource"
key="userDB">
<set-property property="driverClassName"
value="sun.jdbc.odbc.JdbcOdbcDriver" />
<set-property property="url"
value="jdbc:odbc:Test" />
<set-property property="username" value="" />
<set-property property="password" value="" />
</data-source>
And I hav set 'Test' as the DSN name
I hav used the code
DataSource dataSource = getDataSource( request, "userDB" );
Connection conn = dataSource.getConnection();
try{
PreparedStatement statement = conn.prepareStatement(
"insert into MYUSER " +
"(EMAIL, FIRST_NAME, LAST_NAME, PASSWORD, PHONE, FAX)" +
" values (?,?,?,?,?,?)");
statement.setString(1,userForm.getEmail());
statement.setString(2,userForm.getFirstName());
statement.setString(3,userForm.getLastName());
statement.setString(4,userForm.getPassword());
statement.setString(5,userForm.getPhone());
statement.setString(6,userForm.getFax());
statement.executeUpdate();
statement.close();
}finally{
conn.close();
}
While executing Im getting an error like
HTTP Status 404 - Servlet action is not available
--------------------------------------------------------------------------------
type Status report
message Servlet action is not available
description The requested resource (Servlet action is not available) is not available.
--------------------------------------------------------------------------------
Apache Tomcat/5.5.9
Pls anybody help me
What is th epblm in my coding..
Is it in struts-config.xml or in java code..
pls
thanx in advace
Litty