How do I connect to a mySQL database in a compiled application?
이전 댓글 표시
I've written a script that successfully communicates with my local mySQL database using a JDBC driver. Here is the relevant code in the script:
javaaddpath(['C:' filesep 'jdbcDriver' filesep 'mysql-connector-java-5.1.21-bin.jar']);
dbname = 'abc';
username = 'abc';
password = 'abc';
driver = 'com.mysql.jdbc.Driver';
dburl = ['jdbc:mysql://localhost:3306/' dbname];
conn = database(dbname, username, password, driver, dburl);
Now I want to compile this and use it on a server. I've placed the driver in I've tried also tried setting the java path in javalibrarypath.txt according to this similar problem
but it doesn't work. Does anyone have a suggestion to how to solve this?
output of
ver:
----------------------------------------------------------------------------------------------------
MATLAB Version: 8.2.0.701 (R2013b)
MATLAB License Number: DEMO
Operating System: Microsoft Windows 8 Version 6.2 (Build 9200)
Java Version: Java 1.7.0_11-b21 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
----------------------------------------------------------------------------------------------------
MATLAB Version 8.2 (R2013b)
Curve Fitting Toolbox Version 3.4 (R2013b)
Database Toolbox Version 5.0 (R2013b)
Image Processing Toolbox Version 8.3 (R2013b)
MATLAB Compiler Version 5.0 (R2013b)
Optimization Toolbox Version 6.4 (R2013b)
Signal Processing Toolbox Version 6.20 (R2013b)
Statistics Toolbox Version 8.3 (R2013b)
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Database Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!