Jump to content
Changes to the Jaspersoft community edition download ×

Multi Database Issue. Lets see if someone can Help


pjamrisk

Recommended Posts

 Hi guys, 

I been working with Jasper for quite a while, and Today I decided to make use of multiple data sources with sub reports. I created the line of report connection in iReport as following (can be edited in the jrxml as well):

java.sql.DriverManager.getConnection("jdbc:jtds:sqlserver://servername/db","user","pass").

Also, we added to the classpath of Jasper the jar driver for jtds, and before mssql 3.0. The mssql property changes a bit but it still goes among those lines so I am not going to retype it.

Anyways, The first day everything worked like a charm and we were getting multiple database connections. Then we created a new report today and we get a Stack Trace error.

Here is the error report 

 


So I am getting the dreaded No Suitable driver found a lot of people has been getting on several different posts around the net. Is this a deficiency of the iReport? or what is not being set correctly. Please let me know if you guys require a little more code, but it really is nothing difficult because all we made is a basic report with a subreport connection.

 

Thanks for your time if you have seen it before.

Patrick Jamriska

 

PD: I tried to do it as well to mysql which was working before and now it doesn't either.

Code:


Post Edited by pjamrisk at 07/07/2010 06:25
Link to comment
Share on other sites

  • Replies 7
  • Created
  • Last Reply

Top Posters In This Topic

Ok, let me ask the question in an easier way. How do you instanciate the driver inside the JRXML to avoid at runtime getting the no driver found error. No one seems to know how to do it. At least not on any single post I have read so far.

 

Thanks for reading the post!

Patrick J.

Link to comment
Share on other sites

Ok, we figured out here that if we copy the driver.jar to the java jre folder we can now use iReport to run the reports, so that is great in case someone needs this as a fix. The only other difficulty we found is that we do not have the same capability to do it on a tomcat application, at least not yet as of this moment but we are working on it. I will post my solution if we figure it out on tomcat.

 

Patrick Jamriska

Link to comment
Share on other sites

  • 2 months later...

 I'm having the exact same problem. It seems impossible to use a different SQL source (even with the same driver!) for a sub-report. I get the same error during the filler: 

java.sql.SQLException: No suitable driver found for jdbc:jtds..

I tried copying the jtds driver .jar file to my JRE folder but that didn't seem to fix anything. 

In my sub-report properties I have: 

Connection type: Use a connection expression
Connection Expression: java.sql.DriverManager.getConnection("blahblah","username","password")

 I find it hard to believe so few people are running sub-reports on different databases?? 

Link to comment
Share on other sites

 Found the solution!! 

I had to create a folder: 

C:\Program Files (x86)\Java\jdk1.6.0_21\jre\classes

And copy my jtds-1.2.5.jar driver to it, and restart iReport.

I found this by going to View -> IDE Log. Near the top you will find "Boot & Ext. Classpath" and in there you will see the reference to a 'classes' folder that doesn't exist. Drop your driver in there. 

 

Link to comment
Share on other sites

Sorry for the late reply. Yes, that was the way of doing it in windows. You will do something similar in linux, except you copy the driver to the jre installation directory.

 

Now you have to do the same for tomcat 6.0, I don't remember whare the instructions were, but you put in somewhere inside the catalina folder.

 

The next problem I currently have is that I start with a mysql database, go to a mssql database SR, and then I  have another  sr inside back to mysql. (don't ask....). So I can't run then the subreport because then it does not see the driver. However, I found out that it will execute fine in tomcat, so I just test it separatle and then compile it for deployment.

 

Hope this post helps a lot of people because I am sure lots of us have run on the same situation.

Patrick

Link to comment
Share on other sites

  • 5 weeks later...

 Ok, 

Now its my turn. I formatted my machine and changed it to Ubuntu. I tried to drop the jar's and now its not working whatsoever. 

Tomcat works, but when I try to compile jasper in linux it just crashes.

I went to windows and tried the posted solution and nothing, it gives me the same problem, the driver was not found.

 

Does anyone know exactly where do we need to place the jars so iReport or plugin always find the correct driver for compiling the report? this is just very annoying already.

 

Thanks,

Patrick

Link to comment
Share on other sites

 OK, here is the solution for Ubuntu 10.10 with netbeans 6.8 and 6.9.1, plus iReport, please post here where you find other solutions as well, as this applies on Windows as well. 

Forget the classes folder, the driver has to be located in this folder to have it working correctly:

/usr/lib/jvm/java-6-sun-1.6xxxx/jre/lib/ext (xxx for whatever revision you have).

Windows is the same exact place, but wherever you installed your JDK. Mine was in:

C:\Program Files\Java\jdk1.6.0_22\jre\lib\ext

Make note of this as this will make subreports work with any database. I was able to connect to 2 different databases at the time without any problems. I will try to post this as well on other places for reference and please pass the message as this is happening all around for a lot of people. And I have been one of them for the longest time. Once you have this working, the Deployment on Tomcat is easy. If you configure your netbeans correctly it will deploythe correct database drivers, and you can create your app to generate reports on the fly and dinamically if needed.

Thanks for everyone who contributed to this post.

Patrick Jamriska

TAGS: subreport, Database subreport, java.sql.Connection, java.sql.DriverManager.getConnection, Multiple Database Connection, connection, driver, sql driver.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...