Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

"UnknownHost" exception while connecting to mysql from web dynpro


I am trying to connect to Mysql 5.0 database from web dynpro application.I am using NWDS 7.1.

I have followed this blog and created the datasource in NWA.

I have written the following code in my web dynpro application.

InitialContext ctx;
		  ctx=new InitialContext();
		  DataSource ds=(DataSource)ctx.lookup("jdbc/dbconnect");
		  Connection conn=ds.getConnection();	
		  Statement stmt=conn.createStatement();
			String query="select Col from TestTable";
			ResultSet res=stmt.executeQuery(query);
				String str1=res.getString(1);
	     }catch (Exception e) {
			// TODO: handle exception

But I m getting the following error as "UnknownHost exception"

I checked with the datasource created in NWA.Here in the Driver status it is showing the driver as unknown.

I have added the following driver.


Any idea on how to solve this problem?

Do I need to add the driver in my application also.

Thanks in advance,


Former Member
Not what you were looking for? View more on this topic or Ask a question