I think this is quite interesting regarding webmethod usage. As you know, webmethod provides you a custom flow steps through Java source code. Currently, I am doing research on how to webmethod connects to database. I am not sure if webmethod has provided you flow steps to do this. but currently I am using Java source to connect to database.
There are several way to get connection to db:
1. Using JDBC code. May be this way is a standard way for all of Java programmer. You can find this way in many resources in internet.
2. A class provided by webmethod. This class acts as an intermediary to connect to DB. Even this class uses JDBC to connect. I assume this class uses JDBC driver and bundle several steps in one method called getConnection(url, username, password, drivername). This method is located at DBConnection class.
For example:
If I use JDBC driver, I need to write the following steps:
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection("jdbc:mysql://localhost/confluence28?user=root&password=arie");
But if we use the webmethod class, we only need to specify one line:
DBConnection dbConnect = db.getConnection("jdbc:mysql://localhost/confluence28", "root", "arie", "com.mysql.jdbc.Driver");
Sunday, May 25, 2008
Webmethod and database (Experience part 2)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment