on 04-10-2006 5:02 PM
Is it possible to use dynamic query sqlj in netweaver developer studio sp15?
Thanks in advance,
Ruben
Hi,
Rubens code is right, but it uses an SQLJ implementation from Oracle. As I know SAP's SQLJ implementation doesn't support dynamic statements ('cause of db independence).
One little hint, always use plain old JDBC if you have to work with dynamic sql (with my experience it's the only thing that's works, ... most time )
regards,
daniel
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There is not possible making dynamic sqlj query but you can cast sqlj to normal sql like
String sql = "..."; //"dynamic sqlj"
SqljIterator itr = null;
java.sql.Connection conn;
ConnEcat context = new ConnEcat(); //sqlj connection
conn = context.getConnection();
java.sql.Statement stmt = conn.createStatement();
java.sql.ResultSet rs = stmt.executeQuery(sql);
#sql itr = { CAST :rs };
//close everithing
Be careful to fields in select fit with iterator
Regards
Vedran
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vedran
Version 9i of SQLJ allows to embed both static and dynamic SQL statements in your SQLJ programs:
int id = 1;
String first_name = null;
String last_name = null;
String phone = null;
String table = "customers";
String query = "id = " + id;
String column = "first_name";
#sql , last_name, phone
INTO
:first_name, :last_name, :phone
FROM
:
WHERE
:
};
which is the version of sqlj in netweaver developer sp15?.
Regards
Ruben
Hi Ruben,
You can create SQLJ source files in projects where the creation of Java sources is allowed. You can either use the wizard to create an SQLJ source file or convert a Java source file to an SQLJ source file.
Please be ensutre that you have added the sqljapi.jar to the build path of your project. You can also use wizard for that.
1. Choose File -> New -> Other .
2. Choose Persistence ® SQLJ source.
3. Choose Next.
4. Enter the required information as if for a normal java file.
5. Choose Finish.
Thanks and Regards
Vishal Kumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.