I work on JDBC applications in Eclipse, and the debugger works fine.
However, I assume you want to step into the JDBC API code itself,
right? Other than not being able to see what is happening on the other
side of the network connection to the actual D/B server, I don't see
why you shouldn't be able to just step right into the JDBC API code,
just like you would step into any other API code. Be prepared for
verbosity, of course :)
-Bill Leue
Randy - 11 Jan 2005 20:28 GMT
I don't need to see what is happening inside the JDBC API. I am new to
the Java world (coming from a VB background), and I would like to debug
my application inside Eclipse without creating the jar, deploying it,
then starting JBoss.
I have tried to create a test application that executes a small query,
but when I try to get a connection to the database, I get the following
error:
Error finding DataSource: javax.naming.NoInitialContextException: Need
to specify class name in environment or system property, or as an
applet parameter, or in an application resource file:
java.naming.factory.initial
java.lang.NullPointerException
Trapper - 12 Jan 2005 02:11 GMT
> I don't need to see what is happening inside the JDBC API. I am new to
> the Java world (coming from a VB background), and I would like to debug
[quoted text clipped - 10 lines]
> java.naming.factory.initial
> java.lang.NullPointerException
Have you tried specifying the required args for this program in the
Arguments section?
Randy - 12 Jan 2005 21:33 GMT
I have the following code in my test class:
public static void main(String[] args)
{
DataSource ds = null;
//String line;
String pSQL = "SELECT ";
pSQL = pSQL + " * ";
pSQL = pSQL + "FROM ";
pSQL = pSQL + " Product ";
String pDatasource = "java:TeradataDS";
try
{
// Load the Teradata Driver
Class.forName("com.ncr.teradata.TeraDriver");
}
catch (ClassNotFoundException e)
{
System.out.println(e);
}
try
{
Context c = new InitialContext();
ds = (DataSource) c.lookup (pDatasource);
//"java:TeradataDS"
}
catch (Exception e1)
{
System.out.println("Error finding DataSource: " + e1);
}
try
{
Connection conn = ds.getConnection();
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(pSQL);
}
catch (Exception e2)
{
System.out.println(e2);
}
}
It is failing on the lookup of the DataSource with the following
message:
Error finding DataSource: javax.naming.NoInitialContextException: Need
to specify class name in environment or system property, or as an
applet parameter, or in an application resource file:
java.naming.factory.initial
java.lang.NullPointerException
Am I missing some kind of supporting file? I have an XML file with my
datasource in my JBoss directory.
Randy
Trapper - 13 Jan 2005 00:09 GMT
> I have the following code in my test class:
>
[quoted text clipped - 55 lines]
>
> Randy
http://java.sun.com/products/jndi/tutorial/getStarted/faq/runtime.html