Results 1 to 7 of 7
- 09-27-2011, 11:00 AM #1
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'";
rs1=st1.executeQuery(sql[1]);Error:May i know what i need to change in the sql command
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("*********************");
}}}Last edited by nandhinianand; 09-27-2011 at 11:04 AM.
- 09-27-2011, 12:21 PM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,476
- Rep Power
- 16
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.
- 09-27-2011, 01:35 PM #3
Member
- Join Date
- Sep 2011
- Posts
- 5
- Rep Power
- 0
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+"'";Last edited by Thiruppathi; 09-27-2011 at 01:37 PM.
- 12-25-2011, 06:26 PM #4
Re: java.sql.SQLException: [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Inc
public class CustomerTable1ISnull extends javax.swing.JFrame {Could you please correct the java.sql.SQLException?
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'.
- 12-25-2011, 09:30 PM #5
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,546
- Rep Power
- 11
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`.
- 12-25-2011, 11:25 PM #6
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
- 12-25-2011, 11:33 PM #7
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,546
- Rep Power
- 11
Similar Threads
-
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]COUNT field incorrect
By harsimran05 in forum JDBCReplies: 5Last Post: 09-11-2011, 05:13 AM -
Exception: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
By Mituff in forum Advanced JavaReplies: 3Last Post: 08-15-2011, 10:16 AM -
java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Invalid Descriptor Index
By nico in forum JavaServer Pages (JSP) and JSTLReplies: 2Last Post: 08-11-2011, 02:41 PM -
[Microsoft][ODBC SQL Server Driver]Invalid Descriptor Index
By leonard in forum JDBCReplies: 1Last Post: 08-06-2007, 09:24 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks