3
votes

I try to get iReport 2.0.4 connected to my database resulting in a ClassNotFound exception. So I downloaded the MS JDBC drivers 4.1 and 4.0 for SQL server. (http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=11774)

I added the jdb jar file to the iReport Classpath:

enter image description here

I restarted iReport and tried to connect to the db again:

File > Report Wizard > Database JDBC connection > Next >

JDBC Driver (com.microsoft.jdbc.sqlserver.SQLServerDriver) JDBC URL: jdbc:microsoft:sqlserver://(myIP):1433;DatabaseName=MYDATABASE

I am getting the same exception.

enter image description here

Could anyone please point me what I am doing wrong?

2
The class name is com.microsoft.sqlserver.jdbc.SQLServerDriver (notice the order of elements: sqlserver before jdbc). - Mark Rotteveel
@Mark Rotteveel - That was it is. I just selected the value (com.microsoft.jdbc.sqlserver.SQLServerDriver") from the iReport dropdown without even noticing the issue t you pointed out. Thanks! - BustedSanta
I believe there has been an old JDBC driver with that classname. BTW: iReport 2 is pretty old (the last version is 5.6, and it has been replaced by JasperSoft Studio). - Mark Rotteveel
@Mark Rotteveel - Mark, please post your comment(s) as the answer below (when you have a chance) so that I can select it as the official answer. Thanks! - BustedSanta

2 Answers

1
votes

The problem is that the classname of the JDBC driver is incorrect. The correct classname is com.microsoft.sqlserver.jdbc.SQLServerDriver (notice the order of elements: sqlserver before jdbc).

I believe that one of the first Microsoft SQL Server JDBC driver did have the classname you tried, but it has since been replaced.

0
votes

First make sure you are added sqljdbc4.jar in your class path . --> Tools->Options->Classpath tab :

enter image description here

1 - In JDBC Driver : com.microsoft.sqlserver.jdbc.SQLServerDriver

2 - In JDBC URL : jdbc:sqlserver://localhost:1433 without database name only port

3 - Database username and password in credentials section

enter image description here