This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of Testing JavaScript Applications and have Lucas da Costa on-line!
See this thread for details.
Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Wanted: Help using DBUnit with MS SQL Server: java.sql.SQLException: Invalid Fetch Size

 
Ranch Hand
Posts: 420
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Question #1: Can someone help me correct this invalid fetch size from DBUnit?

I'm using java 1.70, dbunit-2.4.8, MS sqlserver 2008 and I'm getting this stack trace:



I thought maybe the problem was that I had to use the Microsoft driver instead of the sun driver. The Sun driver seems to connect OK but produces the exception on line 28.

As you can see from my comments, I've tried both the sun and microsoft drivers.



I'd love to know how to use com.microsoft.sqlserver.jdbc.SQLServerDriver too.

Question #2: Can someone help me make this work with the Microsoft Driver? I cannot seem to get the connection string right and it keeps dying on the call to getConnection.


Exception in thread "main" com.microsoft.sqlserver.jdbc.SQLServerException: The connection to the host localhost, named instance sqlexpress has failed. Error: "java.net.SocketTimeoutException: Receive timed out". Verify the server and instance names, check that no firewall is blocking UDP traffic to port 1434, and for SQL Server 2005 or later verify that the SQL Server Browser Service is running on the host.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:171)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.getInstancePort(SQLServerConnection.java:3174)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.primaryPermissionCheck(SQLServerConnection.java:937)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:800)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:700)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:842)
at java.sql.DriverManager.getConnection(DriverManager.java:579)
at java.sql.DriverManager.getConnection(DriverManager.java:243)
at DatabaseExportSample.main(DatabaseExportSample.java:19)


 
Sheriff
Posts: 21972
106
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure the instance is called SQLEXPRESS? From http://technet.microsoft.com/en-us/library/ms143744(SQL.90).aspx:

SQL Server Express always installs a named instance (SQLExpress) unless you select a default instance. This behavior differs from SQL Server 2005, which installs a default instance unless a named instance is selected.


Try it without the "\\SQLEXPRESS" part to see if that works.
 
Siegfried Heintze
Ranch Hand
Posts: 420
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the suggestion but

(1) the program at the bottom works (and contains SQLEXPRESS)
(2) I took the SQLEXPRESS out of the other two connection strings in the first program that uses DBUnit and neither connection string works.

Any more suggestions?

Thanks
Siegfried

 
I found a beautiful pie. And a tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic