cancel
Showing results for 
Search instead for 
Did you mean: 

Creation of tables using JDBC or SQLJ in webdynpro application

Former Member
0 Kudos

Hi,

I am trying to create tables in javadictionary(MaxDB)using my WebDynpro application.I tried creating tables using SQLJ and JDBC.But I was not able to do it.I can select and insert data into already created tables.

Whwn I tried creating a table using JDBC I encountered the following exception.

com.sap.sql.log.OpenSQLException: The SQL statement "CREATE TABLE TMP_DEPID (DEPID varchar(10) NOT NULL,DEPNAME VARCHAR(25))" contains the syntax error[s]: Open SQL syntax error: CREATE ... TABLE is not supported

SQL syntax error: "VARCHAR" is a reserved keyword and cannot be used as an unquoted identifier

Does this mean that creating tables is not supported?

Can anyone help me in this matter?

Thanks in advance,

regards

~Pradeep Shetty

Accepted Solutions (0)

Answers (1)

Answers (1)

Vlado
Advisor
Advisor
0 Kudos

Hi Pradeep,

Yes, OpenSQL does not support creation of tables. But why would you need to create tables at runtime?! The natural way is to create the model at design time of your application, i.e. with the Java DataDictionary.

However, if for any reason you really need to create database tables at runtime, you can achieve this by using a non-OpenSQL datasource, e.g. you could create a VendorSQL one and use it to obtain JDBC connections in your app. See also http://help.sap.com/saphelp_nw04/helpdata/en/c0/3ad4d5cdc66447a188b582aad537d3/frameset.htm.

Hope that helps!

Vladimir

Former Member
0 Kudos

Hi Vladimir,

Thank you for your prompt reply.

If I use VendorSQL then the application will be database specific,which I don't want.

I want to create tables at runtime because at design time I'm not aware of the no.of cols,datatype of each field,what is the primary key etc.

Is there any solution for this problem?

Vlado
Advisor
Advisor
0 Kudos

Hi Pradeep,

But if you use CREATE TABLE... you already make your application DB specific. That's why Open SQL does not allow it. So, I guess you should either sacrifice database independence or find a way to create your tables at design/dev time with the Java DataDictionary.

HTH!

Vladimir