on 08-22-2007 11:10 AM
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!
Hello,
I think the problem is:
I don't have installed the mysql driver on the portal... so how can I do this?
Or how can i check this?
thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
I can deploy the application successful, but when it is deployed the server crashes down. I think the problem ist the mySQL Connector on wich I refer: Class.forName("com.mysql.jdbc.Driver");
On my local machine the driver is installed but in the Portal he isn't installed.
Thanks for your answers!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
go thru dis blog
it will b helpful n will solve ur prob
/people/venkatesh.ramachandran/blog/2006/10/19/how-to-create-and-remove-data-source-on-sap-was-j2ee-engine-dynamically-through-java
JDBCDescriptor jdbcDescriptor = new JDBCDescriptor();
jdbcDescriptor.setDataSourceName("ds_venky");
jdbcDescriptor.setDriverClassName("org.gjt.mm.mysql.Driver");
jdbcDescriptor.setDriverName("mysql");
jdbcDescriptor.setInitConnections(2);
jdbcDescriptor.setMaxConnections(10);
jdbcDescriptor.setPassword("xxxx");
jdbcDescriptor.setURL("jdbc:mysql://172.22.76.8:3306/wise");
jdbcDescriptor.setUsername("xxxx");
Properties ctxProp = new Properties();
ctxProp.put(
Context.INITIAL_CONTEXT_FACTORY,
"com.sap.engine.services.jndi.InitialContextFactoryImpl");
ctxProp.put(Context.PROVIDER_URL, "myServerName:50004");
ctxProp.put(Context.SECURITY_PRINCIPAL, "xxxx");
ctxProp.put(Context.SECURITY_CREDENTIALS, "xxxx");
InitialContext context = new InitialContext(ctxProp);
DataSourceManager dsm =
(DataSourceManager) context.lookup("dbpool");
dsm.createDataSource("ds_venky", jdbcDescriptor);
Hi Johannes,
what type of exception do you have? Hovewer, a detailed documentation on "Using JDBC with MySQL" is here:
http://www.developer.com/java/data/article.php/3417381
Hope this help you.
Regards,
Vito
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI johannes,
Web dynpro application should follow some coding rules,
The following lines are not accepted by web dynpro
you first go through the web dynpro documentaions
e.printStackTrace();
System.exit(1);
System.out.println(time.toString());
System.out.println(time);
System.out.print(rs.getString(6));
System.out.print(" --- " + rs.getString(7));
System.out.print(" --- " + rs.getString(8));
System.out.println(" --- " + rs.getString(9));
e5.printStackTrace();
in webdynpro replace following
system.out.println()----
>wdComponentAPI.getMessageManager().reportSuccess()
To start with WD Java, the following tutorial wil be helpfiul
http://help.sap.com/saphelp_nw04/helpdata/en/f8/bdfe80d9a3b048a5fb32a7d149774e/frameset.htm
To know about Web Dynpro UI Element Reference Guide
http://help.sap.com/saphelp_nw04/helpdata/en/5c/1b76bc3da0504e8b535cf3e154eaa7/frameset.htm
please go to following url,
there is lot of basic tutorials is there. please go throught it
Refer these links
Why webdynpro and not BSP or JSP?
WEbDynpro Java vs. WebDynpro ABAP
regarding Java related webdynpro
Web Dynpro vs. Struts - a few questions
What kind of applications are being developed with Web Dynpro?
Check this:
http://www.sappro.com/downloads/OptionComparison.pdf
Refer these links
regarding Java related webdynpro
Regards,
P.Manivannan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
98 | |
11 | |
11 | |
10 | |
10 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.