Skip to Content
avatar image
Former Member

Read MYSQL with WebDynpro

Hello Experts,

i want to read data from a mySQL Database with WebDynpro. If i write a java programm to do this it works perfectly, but if I use this Java code in my WebDynpro Application it doesn't work.

So how can I run this code in my WebDynpro-project:

String Query = null;

java.sql.Connection con = null;

java.sql.Statement stmt = null;

ResultSet rs = null;

try {

Class.forName("com.mysql.jdbc.Driver");

}

catch (ClassNotFoundException e) {

e.printStackTrace();

System.exit(1);

}

System.out.println(time.toString());

System.out.println(time);

try {

con =

DriverManager.getConnection(

"jdbc:mysql://server.com",

"user",

"password");

stmt = con.createStatement();

rs = stmt.executeQuery("USE database");

rs = stmt.executeQuery("SELECT * FROM table");

while (rs.next()) {

System.out.print(rs.getString(6));

System.out.print(" --- " + rs.getString(7));

System.out.print(" --- " + rs.getString(8));

System.out.println(" --- " + rs.getString(9));

}

con.close();

rs.close();

stmt.close();

}

catch (SQLException e5) {

e5.printStackTrace();

}

Thanks!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers