my dog learned polymorphism*
The moose likes JDBC and the fly likes MKoi database error - reads values when looking for column headings Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "MKoi database error - reads values when looking for column headings" Watch "MKoi database error - reads values when looking for column headings" New topic
Author

MKoi database error - reads values when looking for column headings

Susie Biddulph
Greenhorn

Joined: Jul 06, 2005
Posts: 2
Hi all,

I'm quite new to mcKoi and I'm trying to use it with JDBC.
I've had success with the SELECT statement, but when I try to INSERT a record I get a....
com.mckoi.database.StatementException.

Here is my code snippet to show the query string I am submitting:-



and here is the debug message I get - note that the values are being interpreted as column names. If you have come across this before, I would be pleased if you could advise me on what I did wrong....

% Starting Database Server
**** Debug log started: Sun Jul 03 15:08:58 BST 2005 ****
% Storage System: v1 file storage mode.
% Internal Data Cache size: 4194304
% Internal Data Cache max cell size: 8192
% lookup_comparison_list = false
% read_only = false
% transaction_error_on_dirty_select = true
% ignore_case_for_identifiers = true
% Java NIO API is available.
% io_safety_level = 10
% Using stardard IO API for heap buffered file access.
% [Buffer Manager] Using IO API: Java IO
% [Buffer Manager] Page Size: 8192
% [Buffer Manager] Max pages: 256
% Using regex bridge: gnu.regexp
% No 'function_factories' config property found.
% statement_cache = true
% Max worker threads set to: 4
% Starting Database Server
> com.mckoi.database.V1FileStoreSystem ( lvl: 20 )
File lock file exists: .\data\DefaultDatabase.lock
> com.mckoi.database.jdbcserver.DefaultLocalBootable$LocalJDBCDatabaseInterface ( lvl: 20 )

Exception thrown during query processing on: [ Query:
[ INSERT INTO member_sb (first ,last ,age ,email) VALUES (Jerry,Smith,27,blah) ]
]
[ TIME: Sun Jul 03 15:08:59 BST 2005 ]
% com.mckoi.database.StatementException: Can't find column: Jerry

at com.mckoi.database.interpret.Statement.resolveColumn(Statement.java:226)
at com.mckoi.database.interpret.Statement.resolveVariableName(Statement.java:249)
at com.mckoi.database.interpret.Statement.resolveExpression(Statement.java:261)
at com.mckoi.database.interpret.Insert.prepare(Insert.java :192)
at com.mckoi.database.interpret.SQLQueryExecutor.execute(SQLQueryExecutor.java:144)
at com.mckoi.database.jdbcserver.AbstractJDBCDatabaseInterface.execQuery(AbstractJDBCDatabaseInterface.java:461)
at com.mckoi.database.jdbcserver.JDBCDatabaseInterface.execQuery (JDBCDatabaseInterface.java:251)
at com.mckoi.database.jdbc.MConnection.executeQuery(MConnection.java:453)
at com.mckoi.database.jdbc.MConnection.executeQueries(MConnection.java:436)
at com.mckoi.database.jdbc.MStatement.executeQueries (MStatement.java:193)
at com.mckoi.database.jdbc.MStatement.executeQuery(MStatement.java:167)
at com.mckoi.database.jdbc.MStatement.executeUpdate(MStatement.java:226)
at foo.MemberBean.addMember(MemberBean.java :96)
at org.apache.jsp.registerMember_jsp._jspService(org.apache.jsp.registerMember_jsp:101)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
at javax.servlet.http.HttpServlet.service(HttpServlet.java :802)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:296)
at org.apache.jasper.servlet.JspServlet.service (JspServlet.java:246)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:106)
at org.apache.catalina.core.StandardEngineValve.invoke (StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection (Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:576)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run (Thread.java:534)


regards,

Suse
Srilakshmi Vara
Ranch Hand

Joined: Jul 21, 2004
Posts: 169
You need to add single quotes to a column of VARCHAR,VARCHAR2 or CHAR type.
For ex:

Insert into table(col1,col2,col3) values ('val1','val2',val3);

Still if you get the error, try to copy the query from logs and execute in SQL prompt separately, then it will give you specific SQL Error.

Srilakshmi
Susie Biddulph
Greenhorn

Joined: Jul 06, 2005
Posts: 2
Srilakshmi,

thank you so much.

It was of course the single quotes - you have a keen eye!

My code works beautifully now,

cheers
Srilakshmi Vara
Ranch Hand

Joined: Jul 21, 2004
Posts: 169
You Are welcome Susie!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: MKoi database error - reads values when looking for column headings