I manage to set up realm inside jboss (tomcat) for mssql, but i have problem
with
inserting/selecting data from db.
I put this code into struts-config:
<data-sources>
<data-source type="org.apache.commons.dbcp.BasicDataSource">
<set-property property="driverClassName"
value="com.microsoft.jdbc.sqlserver.SQLServerDriver" />
<set-property property="url"
value="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=WorkFlow" />
<set-property property="username" value="sa" />
<set-property property="password" value="" />
<set-property property="maxActive" value="10" />
<set-property property="maxWait" value="5000" />
<set-property property="defaultAutoCommit" value="false" />
<set-property property="defaultReadOnly" value="false" />
</data-source>
</data-sources>
and this code into some action:
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
ResultSet rs2 = null;
DataSource dataSource =
(DataSource)servlet.getServletContext().getAttribute("org.apache.struts.action.DATA_SOURCE");
try {
conn = dataSource.getConnection();
stmt = conn.createStatement();
int id = 0;
rs = stmt.executeQuery("select max(id) as counter from owner");
while(rs.next()){
id = rs.getInt("counter");
}
id += 1;
stmt.executeUpdate("insert into owner values(" + id + ", '" + "rere"
+ "', '" + "name" + "', '"
+ "šđč枊ĐČĆŽ" + "', '" + "adresa" + "', " + "10" + ")");
rs.close();
stmt.close();
conn.close();
}
catch(SQLException e){
throw new SQLException("database error");
}
This part of code (in action class) perfectly works for mysql, but here i get
error Unhandled
exception type SQLException.
What is wrong?
Tnx, Stanislav
PS: I didnt change anything in other files and everything works with mysql.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]