I have deployed karshamarkup.war file on Stratoes Application server. I have created a database on Data services server. These are my connection details on Data services server.
Driver Class: com.mysql.jdbc.Driver JDBC URL:
jdbc:mysql://rss1.stratoslive.wso2.com/karshamarkuptool_karsha_opensource_lk
Username: root_lQrhzZUK Password: nbuser
This is my connection code on ControllerServelet.java file
String connectionURL = "jdbc:mysql://rss1.stratoslive.wso2.com/karshamarkuptool_karsha_opensource_lk";
Connection connection=null;
try{
Class.forName("com.mysql.jdbc.Driver");
connection = DriverManager.getConnection(connectionURL, "root_lQrhzZUK",
"nbuser");``
Statement st = connection.createStatement();
ResultSet rs = st.executeQuery("SELECT FIBOTerm from fiboterm");
I have inclued the mysql Connector jar in the lib folder /WEB-INF/lib.
But I’m unable to pull out data from the Data services server database. (This works file with my local mysql databse)
Do I need more configurations on Data services server/ app serevr or on web.xml file to work this properly?
By using dataSource = new BasicDataSource() solved my problem, here is how I connected to database