Database Toolbox Update-Function - No constructor with matching signature found

6 ビュー (過去 30 日間)
Chris Mönch
Chris Mönch 2017 年 4 月 24 日
回答済み: Helper 2018 年 6 月 12 日
Hello all,
I use the Toolbox Database to create insert and update an SQLite DB connection.
If I used the function update, I receive the Error:
update(conn, 'Demo_FeatureTable',updateColnames,updateData,updateWhereClause)
"No constructor 'update' with matching signature found."
Where the Parameter are:
updateColnames = {'ID_Form' , 'ID_Description'};
IDs=[1:1:30]';
updateDataR1 = ones(30,1)*999;
updateDataR2 = ones(30,1)*999;
updateData= { updateDataR1 updateDataR2};
updateWhereClause=cell(30,1);
for k= 1:1:size(updateWhereClause,1)
updateWhereClause{k} = ['WHERE ID = ' '' num2str(IDs(k)) ''];
end
  1 件のコメント
Chris Mönch
Chris Mönch 2017 年 4 月 25 日
Solution: Go to: MATLAB -> Home -> Environment -> Set Path Select Database Toolbox & move to Top & Apply. Then Close Matlab AND Restart the PC. Then the right functin gehts called.

サインインしてコメントする。

回答 (3 件)

Helper
Helper 2018 年 6 月 12 日
The issue here appears to be that the custom function named "lookup” (and "update") conflicts with a Java class named "lookup” (and "update") that was introduced in R2015a by Robotics System Toolbox. In MATLAB, a Java constructor has higher precedence than a function in an M file of the same name. This is causing the error message. Thanks, Dr. Andrea for reporting this issue. Our team has already noticed this issue and we are evaluating this issue.
There are several potential workarounds:
1) Re-name the "lookup" (“update”) custom function. Using some name that may identify the custom function would be the best practice. This might be the best way to avoid any issue in the future. We are also working on nodulizing our toolbox, which might be accomplished in the future release of MATLAB.
2) You could create a custom package folder, add custom function "lookup" (“update”) into that package folder, and then update all references to "lookup" (“update”) in the toolbox files to call "lookup" with the package name prepended. For more information about this workflow, see the following documentation link:
https://www.mathworks.com/help/matlab/matlab_oop/scoping-classes-with-packages.html
3) Since this Java constructor is introduced by Robotics System Toolbox, if you do not use this toolbox, then uninstalling this toolbox will also resolve this issue.
4) The "lookup" and "update" Java constructors are introduced by "dnsjava.jar", which is used to call a DNS server to get the IP address for host names that the user provides.
Thus, if you use ROS (Robot Operating System), but always connects to ROS systems via IP address, then there is a better workaround instead of uninstalling the toolbox. We could remove this Java class from the Java path. Since we know which Java class causes this issue, then it is easier for us to prevent MATLAB to load this class.
Please try the following steps:
1. Close MATLAB.
2. Open the file matlabroot/toolbox/local/classpath.txt. Note that this might require administrative access.
3. Find the following line: $matlabroot/java/jarext/rosjava/dnsjava.jar
4. Cut "$matlabroot/java/jarext/rosjava/dnsjava.jar", and paste it into the end of the file.
5. Put a number sign (#) in front of "$matlabroot/java/jarext/rosjava/dnsjava.jar", so we have # $matlabroot/java/jarext/rosjava/dnsjava.jar
6. Finally, restart MATLAB. From now, MATLAB would not load this Java class and the"lookup" Java constructor in issue will be gone.
If you need the DNS service later, just delete the number sign and MATLAB will load this Java class again.
(Note please contact MathWorks Technical Support if removing the dnsjava.jar will affect your existing projects.)

Walter Roberson
Walter Roberson 2017 年 4 月 24 日

Andrea Mari
Andrea Mari 2018 年 4 月 18 日
編集済み: Andrea Mari 2018 年 4 月 18 日

The problem is that some Matlab installations have a java lookup constructor originating from a toolbox that takes the precedence over all functions, in a way that is not documented on the page concerning precedence ( Function Precedence Order ). To my knowledge, this precedence cannot be changed. I have made a query to Mathworks to know what is the toolbox that includes the java lookup constructor, but I have not received a satisfactory answer yet. On my PC installation, I don't have this problem with R2015b and R2018a. However, with an R2017a installation with more toolboxes the problem is present. I suspect that the problem can be solved if the critical toolbox is removed (entirely, not just from the path), but not knowing the toolbox I could not try. In the R2018a documentation, lookup appears to belong to the Datafeed toolbox, but this toolbox is not present in my R2017a installation and therefore it is probably not the culprit. More if I will get more info from Mathworks...

カテゴリ

Help Center および File ExchangeReporting and Database Access についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by