Skip to main content



      Home
Home » Eclipse Projects » EclipseLink » Problem while executing the stored procedure
Problem while executing the stored procedure [message #387429] Wed, 29 April 2009 02:13 Go to next message
Eclipse UserFriend
Hi,
I have a simple procedure in SQLServer database.While I am executing
the procedure using EclipseLink JPA I am getting some errors.


Project project = new Project();
DatabaseLogin login = new DatabaseLogin();
login.setUserName(DATABASE_USERNAME);
login.setPassword(DATABASE_PASSWORD);
login.setConnectionString(DATABASE_URL);
login.setDriverClassName(DATABASE_DRIVER);
login.setDatabaseName("testdemo22");
project.setDatasourceLogin(login);
Session s = project.createDatabaseSession();
s.setLogLevel(SessionLog.FINE);
((DatabaseSession)s).login();

StoredProcedureCall call = new StoredProcedureCall();
call.setProcedureName("insert_user");//procedure name
DataModifyQuery query = new DataModifyQuery();
query.setCall(call);
s.executeQuery(query);

When I run this code I am gettting the folllowing errors.

Internal Exception: com.microsoft.sqlserver.jdbc.SQLServerException:
Incorrect syntax near the keyword 'PROCEDURE'.
Error Code: 156
Call: EXECUTE PROCEDURE insert_user()
Query: DataModifyQuery()
Exception in thread "main" Local Exception Stack:
Exception [EclipseLink-4002] (Eclipse Persistence Services - 1.0 (Build
1.0 - 20080707)): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.microsoft.sqlserver.jdbc.SQLServerException:
Incorrect syntax near the keyword 'PROCEDURE'.
Error Code: 156
Call: EXECUTE PROCEDURE insert_user()
Query: DataModifyQuery()
at
org.eclipse.persistence.exceptions.DatabaseException.sqlExce ption(DatabaseException.java:313)
at
org.eclipse.persistence.internal.databaseaccess.DatabaseAcce ssor.executeDirectNoSelect(DatabaseAccessor.java:757)
at
org.eclipse.persistence.internal.databaseaccess.DatabaseAcce ssor.executeNoSelect(DatabaseAccessor.java:823)



Any Ideas please?

Regards
kondal
Re: Problem while executing the stored procedure [message #387434 is a reply to message #387429] Wed, 29 April 2009 09:01 Go to previous messageGo to next message
Eclipse UserFriend
Make sure you set your DatabasePlatform in your login to SQL Server.

i.e.
login.useSQLServer();

---
James
http://www.nabble.com/EclipseLink---Users-f26658.html
Re: Problem while executing the stored procedure [message #387439 is a reply to message #387434] Wed, 29 April 2009 10:23 Go to previous messageGo to next message
Eclipse UserFriend
Thanks.It is working.Is there any generic method to login to any database.


Regards
kondal
Re: Problem while executing the stored procedure [message #387444 is a reply to message #387439] Thu, 30 April 2009 09:09 Go to previous message
Eclipse UserFriend
Since you are setting other database/driver specific information on the
login, it is probably not a big deal to also set the platform.

In JPA if you do not set the platform it is auto-detected by default.
Using the native API you can do this by calling loginAndDetectDatasource()
on DatabaseSessionImpl instead of login().

---
James
http://www.nabble.com/EclipseLink---Users-f26658.html
Previous Topic:EclipseLink+Spring+ComboPooledDataSource+MySQL ORM not persisting
Next Topic:Support for views in eclipse link
Goto Forum:
  


Current Time: Sat Aug 30 16:10:54 EDT 2025

Powered by FUDForum. Page generated in 0.04127 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top