cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot assign a blank-padded string to host variable 4

Former Member
0 Kudos

I was running this Rental Car Application.

I was unable to save a row into DB.

I saw trace statements in <b>default.trace.</b> log file under

C:\usr\sap\J2E\JC00\j2ee\cluster\server0\log.

I made sure none of them is null by printing them in Session EJB before calling the entity bean.

Does anyone has an insight on this?

Pleaseeeeeeee help me in this matter.

And also is that how we see the log/System.out.print statements or is there an easy way to check the log/System.out.print statments?

Thanks in advance

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Mark

Before you call the "create" Method of your QuickBookingBean do the following:

bookingId = bookingId.trim();

vehicleTypeId = vehicleTypeId.trim();

pickupLocation = pickupLocation.trim();

dropoffLocation = dropoffLocation.trim();

I also did the same in the Servlet Method:

formatBooking(QuickBookingModel[] bookings)

booking[0] = bookings<i>.getBookingId().trim()

booking[1] = bookings<i>.getVehicleType().trim();

booking[2] = bookings<i>.getPickupLocation().trim();

booking[3] = bookings<i>.getDropoffLocation().trim();

booking[4] = bookings<i>.getDateFrom().trim();

booking[5] = bookings<i>.getDateTo().trim();

booking[6] = bookings<i>.getPrice().trim();

It solved my problem.

Regards Paul

Former Member
0 Kudos

Paul,

That solved my problem too.

Thanks a lot.

-Mark

Former Member
0 Kudos

There is a display issue in the code snippit for the second trim. Since the forum read [] with an i in it as italics it does not display. So just remove the spaces on each side of the i in the [].

booking[0] = bookings[ i ].getBookingId().trim();
booking[1] = bookings[ i ].getVehicleType().trim();
booking[2] = bookings[ i ].getPickupLocation().trim();
booking[3] = bookings[ i ].getDropoffLocation().trim();
booking[4] = bookings[ i ].getDateFrom().trim();
booking[5] = bookings[ i ].getDateTo().trim();
booking[6] = bookings[ i ].getPrice().trim();

This should do it.

Former Member
0 Kudos

Guys,

I am getting a similar problem, can you please help out? cmp field is not blank string yet I am getting the error.

_33##0#0#Info##Plain###Remote Exception in Create: CreateA2iLogin: com.sap.engine.services.ejb.exceptions.BaseRemoteException: Exception in method a2i.beans.login.LoginHomeImpl0.create(java.lang.String).

at a2i.beans.login.LoginHomeImpl0.create(LoginHomeImpl0.java:408)

at a2i.beans.login.LoginHome_Stub.create(LoginHome_Stub.java:56)

at com.nibco.a2i.beans.A2iLogin.createA2iLogin(A2iLogin.java:118)

at com.nibco.a2i.beans.A2iLogin.<init>(A2iLogin.java:38)

at com.nibco.training.servlet.SayHelloServlet.doPost(SayHelloServlet.java:121)

at com.nibco.training.servlet.SayHelloServlet.doGet(SayHelloServlet.java:32)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:391)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:265)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:345)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:323)

at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:865)

at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:240)

at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)

at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)

at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)

at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)

at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)

at java.security.AccessController.doPrivileged(Native Method)

at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:94)

at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)

Caused by: com.sap.engine.services.ejb.entity.ContainerException: Exception in method ejbStore().

at com.sap.engine.services.ejb.entity.ContextFP.store(ContextFP.java:118)

at com.sap.engine.services.ejb.entity.ContextFP.store0(ContextFP.java:103)

at com.sap.engine.services.ejb.entity.Context.passivate(Context.java:235)

at a2i.beans.login.LoginHomeImpl0.create(LoginHomeImpl0.java:401)

... 21 more

Caused by: com.sap.engine.services.ejb.exceptions.BaseEJBException: SQLException while the data is being flushed. The persistent object is a2i.beans.login.LoginBean0Persistent.

at com.sap.engine.services.ejb.entity.pm.UpdatablePersistent.ejbFlush(UpdatablePersistent.java:101)

at com.sap.engine.services.ejb.entity.pm.TransactionContext.flushAll(TransactionContext.java:429)

at com.sap.engine.services.ejb.entity.pm.TransactionContext.flush(TransactionContext.java:378)

at com.sap.engine.services.ejb.entity.pm.TransactionContext.finishWork(TransactionContext.java:454)

at a2i.beans.login.LoginBean0PM.ejbStore(LoginBean0PM.java:184)

at com.sap.engine.services.ejb.entity.ContextFP.store(ContextFP.java:115)

... 24 more

Caused by: com.sap.sql.log.OpenSQLException: Cannot assign an empty string to host variable 1.

at com.sap.sql.log.Syslog.createAndLogOpenSQLException(Syslog.java:85)

at com.sap.sql.log.Syslog.createAndLogOpenSQLException(Syslog.java:124)

at com.sap.sql.jdbc.common.CommonPreparedStatement.setString(CommonPreparedStatement.java:584)

at com.sap.engine.services.dbpool.wrappers.PreparedStatementWrapper.setString(PreparedStatementWrapper.java:341)

at a2i.beans.login.LoginBean0Persistent.ejb_iInsert(LoginBean0Persistent.java:335)

at com.sap.engine.services.ejb.entity.pm.UpdatablePersistent.ejbFlush(UpdatablePersistent.java:92)

... 29 more

; nested exception is:

com.sap.engine.services.ejb.entity.ContainerException: Exception in method ejbStore().#

#1.5#001143A7AF4000680000005900000F4C00040C3E95D97A60#1139362848402#System.out#sap.com/A2IEARCURR#System.out#Guest#0####edec5450984311da917b001143a7af40#SAPEngine_Application_Thread[impl:3]_33##0#0#Info##Plain###Success 2#

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Mark

I have the same problem. The values are neither NULL nor

"".

Did you find a solution?

Thanx Paul

Vlado
Advisor
Advisor
0 Kudos

Hi Mark,

This issues is described <a href="http://help.sap.com/saphelp_nw04/helpdata/en/13/dbb2b66146934a9662918755038ea1/frameset.htm">here</a>:

<i>cmp-fields with java.lang.String or byte[] Java types at runtime must not have an empty value. This may lead to unpredictable database behavior.</i>

Regarding your second question about System.out.print statements, of course you can look for them in the defaultTrace.trc files, but you could also use the LogViewer to display them. Check the following link:

http://help.sap.com/saphelp_nw04/helpdata/en/57/5f1140d72dc442e10000000a1550b0/frameset.htm

Hope that helps!

Vladimir

Former Member
0 Kudos

Vladmir,

Thanks for your reply.

But unfortunately, that doesnt help me solve this issue.

I am sure none of the values are null before handling it to entity beans.

Anyone please throw some light on this.Plsssssssssssssss

The error log is as

ava#com.sap.sql.jdbc.common_1106#com.sap.sql.log.OpenSQLResourceBundle#Cannot assign a blank-padded string to host variable 4.#1#4#

#1.5#000E3564323400370000001000000C080003FB32AD483711#1120620153161#com.sap.sql.jdbc.common.CommonPreparedStatement#sap.com/QuickCarRentalApplication#com.sap.sql.jdbc.common.CommonPreparedStatement#Guest#2#SAP J2EE Engine JTA Transaction : 070ffffffdbffffff9a0000####SAPEngine_Application_Thread[impl:3]_11##0#0#Error#1#/System/Audit#Java###Exception #1#com.sap.sql.log.OpenSQLException: Cannot assign a blank-padded string to host variable 4.

at com.sap.sql.log.Syslog.createAndLogOpenSQLException(Syslog.java:81)

at com.sap.sql.jdbc.common.CommonPreparedStatement.setString(CommonPreparedStatement.java:591)

at com.sap.engine.services.dbpool.wrappers.PreparedStatementWrapper.setString(PreparedStatementWrapper.java:341)

at com.sap.examples.quickcarrental.QuickBookingBean0Persistent.ejb_iInsert(QuickBookingBean0Persistent.java:354)

Vlado
Advisor
Advisor
0 Kudos

Hi Mark,

I'm not talking about null values - it's about empty strings. You must not attempt to store in the database a cmp-field that has the value "".

Best regards,

Vladimir

Former Member
0 Kudos

Vladmir,

The values are not empty too.Iam sure about that.

Iam really sorry for not mentioning it in the previous messages.