Jump to content

SQL connection problem


StaySick

Recommended Posts

Hey, im kinda new using iReport and i have a problem with the connection to my sql 2005 DB, I've copied the tools.jar (jdk 6) file to the lib directory and downloaded the driver, the driver is already at lib directory of iReport and in my "jar" classpath and still getting the following message:

 

ClassNotFoundError!

Msg: com.microsoft.jdbc.sqlserver.SQLServerDriver

 

This class may have not been found: com.microsoft.jdbc.sqlserver.SQLServerDriver

Check your classpath

 

I dont understand whats happening, hope you can help me, btw im using iReport 1.3.0 and this is my string conn

jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=DB

Link to comment
Share on other sites

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

in iReport 1.3 go to Options -> Classpath and put the actual jar file full path in there for the jdbc driver.

 

you might also ant to consider using the jtds driver instead, in my experience it works much better when connecting to sql server - net.sourceforge.jtds.jdbc.Driver

Link to comment
Share on other sites

  • 1 year later...

I'm using iReport 2.0.4 and ran into the same issue despite having added the jar file to the classpath in iReport and the environment variable (Windows XP). After about my third reboot I ran across the following article:

 

[url=http://blogs.msdn.com/jdbcteam/archive/2007/06/15/java-lang-classnotfoundexception-com-microsoft-jdbc-sqlserver-sqlserverdriver.aspx]http://blogs.msdn.com/jdbcteam/archive/2007/06/15/java-lang-classnotfoundexception-com-microsoft-jdbc-sqlserver-sqlserverdriver.aspx

 

...which explains that the class name has changed between the SQL Server 2000 JDBC driver and the SQL Server 2005 JDBC driver. Additionally, the SQL Server 2005 JDBC driver has a different URL prefix from the SQL Server 2000 JDBC driver. Both the classname and URL prefix were incorrectly defaulted to the old version of SQL Server in iReport 2.0.4. Changing the driver (thankfully the drop down list accepts copy/paste) from "com.microsoft.jdbc.sqlserver.SQLServerDriver" to "com.microsoft.sqlserver.jdbc.SQLServerDriver" and the prefix from "jdbc:microsoft:sqlserver://" to "jdbc:sqlserver://" fixed the problem.

Link to comment
Share on other sites

  • 2 weeks later...
  • 8 months later...
  • 1 year later...

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...