Skip to Content

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

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!

Former Member
Former Member replied

You have to access Visual Admin, then choose JDBC Connector -> Drivers, then load the Driver (jar file).

Restart AS Stack Java and then you can create all DataSources you need.

Hope this help.

Vi.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question