wood burning stoves 2.0*
The moose likes JDBC and the fly likes The source attachment does not contain the source for the file SQLServerConnection.class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "The source attachment does not contain the source for the file SQLServerConnection.class" Watch "The source attachment does not contain the source for the file SQLServerConnection.class" New topic
Author

The source attachment does not contain the source for the file SQLServerConnection.class

J. Howard
Greenhorn

Joined: Apr 30, 2013
Posts: 4
I get this message when executing an SQL Server database SELECT in the following code:

import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

...

try
{
SQL = "SELECT DATA_VALUE_STRING FROM dbo.MISCELLANEOUS_DATA_R " +
"WHERE DATA_NAME = LAST LOAD DATE TIME";
stmt = con.createStatement();
rs = stmt.executeQuery(SQL);
if (rs.next() ) {
rs.next();
Date lastRunDate = rs.getDate(1);
System.out.println(dataDateTime + "///" + lastRunDate);
}
}
catch(Exception e)
{
System.out.println("Error 5: " + e.getMessage() + " SQL: " + SQL);
System.exit(5);
}

The error occurs on the stmt = con.createStatement(); line.

This is the 5th database call in my program, and the preceeding 4 work fine. This code was copy & pasted from previously executed code, so it is exactly the same except for the SQL variable.

Any help would be greatly appreciated.

John
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Hi John, welcome to the Ranch!

I think I recognize that message, it comes from Eclipse. You didn't mention that you were using Eclipse, and that would have been useful information. And are you running your code in Debug mode? Because that message appears when the debugger tries to step into code for which you don't have the source. It doesn't particularly say anything about your actual code, not even that there's an error.
J. Howard
Greenhorn

Joined: Apr 30, 2013
Posts: 4
You are correct. I am using Eclipse, and the code runs fine when not in debug mode.

How can I fix this? I am a newbie, so please keep it as simple as possible.

Thanks,

John
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38486
    
  23
Welcome again.

You do not need to fix that error at all. What it means is that you are using a class whose bytecode is available but not its text code. When you are debugging, Eclipse can show the original code and the line number where an Exception occurred. Much code is only supplied in .jar files, which only contain the bytecode, so that Exception information is not available.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: The source attachment does not contain the source for the file SQLServerConnection.class