ORA-00933: SQL command not properly ended
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Di_Tran
Posted On:   Friday, August 30, 2002 06:55 AM

I wrote a small piece of code to access Our Oracle database to search for data in one specific table based on the input by user's (as a key). I got the above SQL error at run-time ...My code is compiled... Below is my piece of code: import java.io.*; import java.sql.*; public class jdbcWork { public static void main(String args []) throws SQLException{ String DbUrl = "jdbc:oracle:thin:@192.168.0.15:1521:o734"; String userid = "peri"; String userPW = "stats"; try { DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver()); Connection connect = DriverManager.getConnection(DbUrl, use   More>>


I wrote a small piece of code to access Our Oracle database
to search for data in one specific table based on the input
by user's (as a key). I got the above SQL error at run-time
...My code is compiled...


Below is my piece of code:

import java.io.*;

import java.sql.*;

public class jdbcWork {

public static void main(String args []) throws SQLException{


String DbUrl = "jdbc:oracle:thin:@192.168.0.15:1521:o734";

String userid = "peri";

String userPW = "stats";

try {

DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());

Connection connect = DriverManager.getConnection(DbUrl, userid, userPW);

PreparedStatement statement =
connect.prepareStatement (
"SELECT * FROM PHONEINFO"

+ "WHERE DNIS = ?");

statement.setString (1, args[0]);

// execute the query

ResultSet res = statement.executeQuery ();

// list the returned rows

while (res.next ()) {

System.out.println ("");

System.out.println ("dnis: " + res.getString (1));

System.out.println ("dnis_type: " + res.getString (2));

System.out.println ("application: " + res.getString (3));

}

statement.close();

connect.close();

}


catch (SQLException e){


System.out.println (e.getMessage ());

e.printStackTrace ();


}

}


}


Thanks in advance for any helps

PhiDi TranThi

   <<Less

Re: ORA-00933: SQL command not properly ended

Posted By:   Denis_Navarre  
Posted On:   Friday, August 30, 2002 07:11 AM

Every time I had this kind of error, it was a SQL error. If the copy-paste of your code is the following:

"SELECT * FROM PHONEINFO"

+ "WHERE DNIS = ?"



-> SELECT * FROM PHONEINFOWHERE DNIS = ?


A space is missing...

About | Sitemap | Contact