• Post Reply Bookmark Topic Watch Topic
  • New Topic

SQL Exception Error

 
raseena nm
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when im trying to run my BMP..
im getting the following error in ejbLoad() of my bean class..
please provide me the solution
java.sql.SQLException: SQL string is not a DML Statement
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The exception message claims that the SQL you tried to execute is not a valid DML statement (DML = Data Manipulation Language). In order to figure out what's wrong with it, you need to post the SQL for us to see.
 
raseena nm
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanx.
the query im trying to execute is..
qr1 = "SELECT OWNERNAME, BALANCE FROM ACCOUNTS WHERE ID =?".
the following is the statement im using to run the query..here after the execute statement im getting that error
conn = getConnection();
pstmt = conn.prepareStatement(qr1);
pstmt.setString(1, id);
ResultSet rs = pstmt.executeQuery();
please suggest any solution.
 
Parijat Mukherjee
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi please check the value of id if it is an integer then u can try
it as pstmt.setInteger(1, id);
 
Parijat Mukherjee
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi please check the value of id if it is an integer then u can try
it as pstmt.setInt(1, id);
 
raseena nm
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanx.
my table structure is like this.
SQL> desc accounts;
Name Null? Type
----------------------------------------- -------- ------------------
ID VARCHAR2(5)
OWNERNAME VARCHAR2(15)
BALANCE NUMBER(5,2)
id field is NOT INTEGER.
so i've given.
pstmt.setString(1, id);
now..give me any solution.
 
raseena nm
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanx.
i got the error cleared.
actually it waz the problem of update query ,which i was using in ejbStore().
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!