i have written a jdbc program and compiled it successfully
on running it i got a error:
Exception in thread "main" java.lang.NoClassDefFoundError: com/microsoft/util/Ut
ilDummyPrintWriter
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:120)
at DBCreate.main(DBCreate.java:7)
the program code is as follows:
import java.sql.*;
import java.util.Properties;

public class Rows
{
public static void main(String args[]) throws SQLException
{
try
{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
Properties p = new Properties();
p.put("User","sa");
p.put("Password","dss");
Connection con = DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:2433",p);
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("SELECT empno,ename,sal FROM emp");
ResultSetMetaData rsmd = rs.getMetaData();
int cols = rsmd.getColumnCount();
System.out.println("the table is :");
for(int i=0;i<=cols;i++)
{
System.out.println(rsmd.getColumnLabel(i) + "\t");
}
System.out.println("\n");
while(rs.next())
{
int empno=rs.getInt(1);
String ename = rs.getString(2);
float sal=rs.getFloat(3);
System.out.println(empno + "\t" + ename + "\t" + sal);
}

rs.close();
stmt.close();
con.close();
}
catch(SQLException s)
{
s.printStackTrace();
}
catch(ClassNotFoundException c)
{
c.printStackTrace();
}
}
}
where is the error :idea:

inside your JDBC driver.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.