Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using multiple SQL server connections with Ireport and Jboss with WebServlet

 
Rudi Steenberg
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all

I am not sure how to connect to multiple databases using ireport and jboss.
I am currently using the following code to create the connection

private Connection getDBConnection()
{
Connection con = null;
String databaseUsername = "";
String databasePassword = "";
String url = "";
try
{
String databaseClass = propertiesFile.getProperty("databaseClass");
Class.forName(databaseClass).newInstance();
url = (new StringBuilder(String.valueOf(propertiesFile.getProperty("databaseURL")))).append(propertiesFile.getProperty("databaseServer")).append(":").append(propertiesFile.getProperty("databasePort")).append(";databaseName=").append(propertiesFile.getProperty("databaseName")).append(";selectMethod=cursor;").toString();
databaseUsername = propertiesFile.getProperty("databaseUsername");
databasePassword = propertiesFile.getProperty("databasePassword");
con = DriverManager.getConnection(url, databaseUsername, databasePassword);
System.out.println("Connected to sql : SUCCESSFULL");
}
catch(Throwable exc)
{
exc.printStackTrace();
}
return con;
}

Which works fine for a single report using one connection. I need to be able to connect to a couple of different DB's which are all on the same SQL server.

Any help or additional info you guys could offer would be greatly appreciated.

Regards
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic