cancel
Showing results for 
Search instead for 
Did you mean: 

Getting SQL Exception when inserting Empty String or null values....

Former Member
0 Kudos

Hi,

I am migrating a J2ee project to SAP netweaver server. As a part of the project, some time i need to store empty string, null values or spaces to the databse tables. But when ever I am trying to insert a record in to the DB with some field values as empty strings (""), I am getting a SQL Exception as given below,

<b>"com.sap.sql.log.OpenSQLException: Cannot assign an empty string to host variable 3"</b>

When i tried to insert a record with empty string as some field values directly in to the table using SQL(insert into.. )statement, I am able to insert the record.

I need to pass the empty string based on the application requirement

Your help and suggestions solicited in this regard.

Thankyou,

Sudheesh K S....

Accepted Solutions (1)

Accepted Solutions (1)

Rudi_Held
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Sudheesh,

What kind of persistence object you get this problem with? Is it a CMP entity bean? Do you use an external database, not the one that comes with the NetWeaver?

The error looks like the datasource uses OpenSQL instead of native or vendor SQL (which may prevent from doing what you want to do).

Check the settings of your datasource in the JDBC connector of the Visual Administrator tool, tabstrip "Additional": it should be native sql (or vendor sql) if you use an external database.

Bye,

Rudi

Former Member
0 Kudos

Hello Rudolf,

Thankyou very much for your reply. Infact i am using CMP Entity beans. I am also using the default DB connection which comes with netweaver (SAP DB).

I searched the JDBC Connector tab of Visual Administrator tool I found Data Source "SAPJ2EDB"; but when i checked for SQL Engine in the "Additional" tab, "Open SQL" is selected. But the all of the three radio button are disabled

Rudolf, Is it because of this settings, I am getting the error? if yes, could you please share your knowledge to change it?

With best regards,

Sudheesh...

Former Member
0 Kudos

Hi,

You are right the SQL Engine option on the 'Additional Tab' are disabled. This is because this is the default database used by WebAS and changes can (mostly will) affect the implementation totally.

Also we refrain from using the default Database for Application purpose.

If we create a seperate batabase then you will have it specifically for your application and also you will have the options (in the 'Additional Tab') enabled.

Regards,

S.Divakar

Former Member
0 Kudos

Dear sir,

Happy New year...

Thankyou very much for your response. I have registered a seperate data source and deployed it in the server using Visual Administration. I made the changes accordingly to the application. But I am getting the error as given below,

"Clusterwide exception: server ID 4102250:com.sap.engine.services.dbpool.exceptions.BaseDeploymentException: Cannot register aliases for DataSource "SAPJ2EDB".

Could you please tell me what could be the possible reason?

With best regards,

Sudheesh K S

Former Member
0 Kudos

Hi,

1. Restart the Server and check in the Visual Administrator Server -> Services -> Deploy, take the group by Applications option.

2. If you see the application (for the datasource you just created, [sap.com/<DataSource Application name>]) in the list of application, delete it

3. Create a new Datasource and the deploy, this should be successful.

Regards,

S.Divakar

Former Member
0 Kudos

Hello sir,

thankyou very much for your support. Now it is working fine.

Happy New year...

With best regards,

Sudheesh...

Former Member
0 Kudos

Hi Sudheesh,

Which container are you migrating your application from? I would like to get more info in this migration aspect from you as you have been very active in this section of the forum

regards,

Sujesh

Former Member
0 Kudos

Hi Sujesh,

Thank you very much for your response. I am migrating an existing j2ee application from JBOSS to SAP Netweaver. The back end database is MYSQL.

We are using CMP Beans with struts frame work. Since i am working in this server for the first time, I have a lot of doubts regarding the deployement and database connectivity.

Now the problems facing are solving slowly with the enormous help from the technocrats from the forums...

Best Regards,

Sudheesh...

Former Member
0 Kudos

Thats great...Theres a first time for every thing...Even Iam planning to do some R n D on it. Can you pls share the experiance or some docs which you have made or you experianced to me. My mail id is kc_sujesh@yahoo.com..whats yours??

Former Member
0 Kudos

Hi sujesh,

Thank you for your comment. So far i used the reference manuals from SAP only. And ofcouurce i got enormous help from SAP Forum. I will mail you the links of the tutorial to your per. Email.

Bu in the mean time if you need any service from me. don't hesitate to mail me to k.ssudheesh@gmail.com

With best regards,

Sudheesh...

Former Member
0 Kudos

Thanks Sudheesh...

Pls send those info to kc_sujesh@yahoo.com..will be of great help...Need to start looking at it asap...

Thanks

Regards,

Sujesh

Answers (0)