Re: connecting to mssql from struts

2005-12-02 Thread Stanislav
> >  > value="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=WorkFlow" />
> 
> Your URL does not look like a correct MySQL URL. It should look something 
> like:
> 
> jdbc:mysql://[host][,failoverhost...][:port]/[database]
> 
> http://dev.mysql.com/doc/refman/5.1/en/cj-configuration-properties.html

:-) That's OK because I'm using MSSQL.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



re: connecting to mssql from struts

2005-12-02 Thread Stanislav
> I manage to set up realm inside jboss (tomcat) for mssql, but i have problem 
> with
> inserting/selecting data from db.
> 
...

I figure it out..

Wrong SQL Exceptio, and missing comit();

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: connecting to mssql from struts

2005-12-02 Thread Robin Clarke
>  value="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=WorkFlow" />

Your URL does not look like a correct MySQL URL. It should look something like:

jdbc:mysql://[host][,failoverhost...][:port]/[database]

http://dev.mysql.com/doc/refman/5.1/en/cj-configuration-properties.html

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



connecting to mssql from struts

2005-12-02 Thread Stanislav
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:


  
 
 
 
 
 
 
 
 
  



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]