java.sql.SQLException: [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorre
for(int x= 0; x < 20; x++) {
for(int y = x + 1; y < 20; y++) {
if(x != y)
count++;
System.out.println( count+") "+Combinedrule[x] + " " + Combinedrule[y]);
String g=Combinedrule[x];
String h=Combinedrule[y];
sql[1]=" select confidence from cpm1 where conbinedrule=Combinedrule[x] ";
sql[2]="select confidence from cpm1 where conbinedrule='h'";
Quote:
Error:May i know what i need to change in the sql command
rs1=st1.executeQuery(sql[1]);
rs2=st1.executeQuery(sql[2]);
while(rs1.next())
{
con1[i]=rs1.getFloat(1);
con2[i]=rs2.getFloat(1);
System.out.println(con1[i]);
System.out.println(con1[i]);
System.out.println("*********************");
}}}
Re: java.sql.SQLException: [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Inc
What's the full exception, with stack trace, you are getting.
Highlight the line where the exception is thrown, and please use code tags when posting code.
Re: java.sql.SQLException: [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Inc
Hi
Change the line with the text highlighted in green color
sql[1]=" select confidence from cpm1 where conbinedrule='"+g+"'";
sql[2]="select confidence from cpm1 where conbinedrule='"+h+"'";
Re: java.sql.SQLException: [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Inc
Quote:
Could you please correct the java.sql.SQLException?
public class CustomerTable1ISnull extends javax.swing.JFrame {
public CustomerTable1ISnull(String st) {
//initComponents();
String Table=st;
System.out.println("Table="+Table);
ResultSet rs = stmt.executeQuery("Select * from '"+Table+"'where p1 is null or p2 is null or p3 is null or p4 is null or p5 is null");
}
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new CustomerTable1ISnull("str1");
}
});
}
Output:
Table=Customer
java.sql.SQLException: [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near 'Customer'.
Re: java.sql.SQLException: [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Inc
Check in the MS SQL documentation whether putting ' around the table name is a valid thing to do. It isn't in MySql which expects backticks like `Customer`.
Re: java.sql.SQLException: [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Inc
Select * from customer where p1 is null or p2 is null or p3 is null or p4 is null or p5 is null
This query is successfully executed in the SQL Query Analyzer.
Thanking you,
With Regards,
Nandhini
Re: java.sql.SQLException: [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Inc