필터 지우기
필터 지우기

Error when inserting data into database without toolbox

조회 수: 3 (최근 30일)
JFz
JFz 2017년 2월 6일
댓글: Guillaume 2017년 2월 6일
Hi,
I don't have database toolbox. But I created a correct connection. I try to use insert function to insert one row into a table, but keep getting this: Undefined function 'insert' for input arguments of type 'sun.jdbc.odbc.JdbcOdbcConnection'. What function should I use if I don't have a toolbox? Thanks for any suggestions.
JF
  댓글 수: 1
Guillaume
Guillaume 2017년 2월 6일
편집: Guillaume 2017년 2월 6일
It would help if you posted the code you're using to create the connection.
Also useful to know would be why you're using a java to odbc driver bridge. Why not connect directly to the odbc driver?

댓글을 달려면 로그인하십시오.

채택된 답변

Guillaume
Guillaume 2017년 2월 6일
Why are you using a jdbc to odbc driver? It would only make sense if you were already familiar with the java sql api, which does not appear to be the case here. You may as well connect directly to the odbc driver from matlab.
As far as I know no odbc (or jdbc) driver offer insert methods. You have to build the SQL query yourself. Refer to your database documentation to know the exact syntax. It's usually something like:
sql = 'INSERT INTO tablename (colum_name, column_name, column_name) VALUES (value, value, value)'
connection.execute(sql);
Possibly wrapped in a transaction.
  댓글 수: 2
JFz
JFz 2017년 2월 6일
Thanks. I am using an existing library which is old and that is the way it is.
I have to insert a table of Matlab back into a database. Maybe I have to use the toolbox. Thanks anyways.
Guillaume
Guillaume 2017년 2월 6일
You don't have to use the toolbox (I don't, since I don't have it) but it's significantly more work without.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

태그

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by