You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by e....@student.utwente.nl on 2007/01/17 13:04:01 UTC

how to get a value out of the database?

Hi,
 
I am new to jetspeed and have a simple portlet runnen.
but now I like to get a value out of the database (mysql). I made an other database named 'test' with a table 'test'
public String getName() throws SQLException, ClassNotFoundException{
  Class.forName("com.mysql.jdbc.Driver");
  Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root");
  Statement statement = connection.createStatement();
  ResultSet resultset = statement.executeQuery("select * from test1 t");
  String naam = resultset.getString("name");
  return naam;
}

please help

Regards, 

Erik


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org