Hey,
I'm using jboss 4.0.3 with mysql 4.1 & connector 
mysql-connector-java-3.0.17-ga.jar

in my ../server/default/mysql-ds.xml I got:


  <local-tx-datasource>
    <jndi-name>DefaultDS</jndi-name>
    <connection-url>jdbc:mysql://localhost:3306/test</connection-url>
    <driver-class>com.mysql.jdbc.Driver</driver-class>
    <user-name>jboss</user-name>
    password
  </local-tx-datasource>


and I have written a program using jsp and javabeans where a javabean tries to 
connect to the database and retrieve some info and display it

the part of the bean that connects look like:

 public void goConnect() {
        
        Context env = null;
        DataSource source = null;
        
        try {
            env = new InitialContext();
            source = (DataSource)env.lookup("jdbc:mysql://localhost:3306/test");
            
            
        } catch(NamingException e) {
            System.out.println("NamingException caught " +e.getMessage());
        }
        
        try{
            

            Connection con = source.getConnection();

            Statement s = con.createStatement();
  
            String sql = "select * from items where name = 'cykel'";

            ResultSet rs = s.executeQuery(sql);
            
            setBaseName(rs.getString("seller"));
            
            s.close();
            con.close();
}

what can be wrong?

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3954995#3954995

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3954995

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to