Sunday, May 25, 2008

Webmethod and database (Experience part 2)

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");

Saturday, May 24, 2008

Experience on WebMethod (Part 1)

Several days ago, my boss (read: my company) gave me a short course on webmethod. This tool is used for integration. Very nice word, it sounds so elegant. However, in the first time I learn this tool, I felt so difficult to learn. Why? because I was not really familiar with the documentation. Besides, there are not a lot of people using this tool. After several days struggling on getting familiar with the flow steps, I can finish all of the exercises that I got from my company.

Last night, I was doing research on how to integrate with flow steps written in Java. Damn, I get an error message saying that no compiler found (this is not the real message). After reading, I found that I need to put a path to the compiler in system path. After making changes on it, I get another error message saying that I need to compile the resource (What the heck !!!!). I was desperate. I thought I had put the correct path and the previous error had been solved. After several hours playing around with the compiler path, I found that I have to use WM compiler instead of my own compiler which is a java compiler that I installed on my PC. Huuuuhh.... succkksss....

In order to make your Java code compiled and run correctly, you need to put compiler bundled by WM. It is located at /jvm/win142/bin. Just put the path into your System path. Then everything works fine.

Wednesday, May 14, 2008

Getting the result of all filter in JIRA

Today, I get another new knowledge regarding JIRA stuff. Currently, I am developing a report plugin in JIRA. This afternoon, I got a problem on populating a value of all saved filters in JIRA. These values are used for specifying parameter in the report plugin. However, after doing some research on JIRA source code. I found the following source code which is used for populating parameters in report plugin.

List savedFiltersList = ManagerFactory.getSearchRequestManager().getVisibleRequests(user);
savedFilters = new HashMap();

for (Iterator iterator = savedFiltersList.iterator(); iterator.hasNext();)
{
GenericValue request = (GenericValue) iterator.next();
savedFilters.put(request.getLong("id").toString(), request.getString("name"));
}


By returning variable savedFilters, then JIRA will populate the value of select component automatically.

SQL Updating certain pattern of text in MySQL

There are a way to update a text in some database with certain pattern. Today I get a case regarding this problem. In order to update a content in a column of a table, you can use the following command:

mysql> update bodycontent SET body = REPLACE ( `body` ,'google.com','arie.ganten
g.com');

The above query will update table bodycontent, body column which content is google.com, to arie.ganteng.com.