- 浏览: 4412284 次
- 性别:
- 来自: 湛江
博客专栏
-
SQLite源码剖析
浏览量:80130
-
WIN32汇编语言学习应用...
浏览量:70350
-
神奇的perl
浏览量:103591
-
lucene等搜索引擎解析...
浏览量:286571
-
深入lucene3.5源码...
浏览量:15054
-
VB.NET并行与分布式编...
浏览量:67786
-
silverlight 5...
浏览量:32292
-
算法下午茶系列
浏览量:46075
文章分类
最新评论
-
yoyo837:
counters15 写道目前只支持IE吗?插件的东西是跨浏览 ...
Silverlight 5 轻松开启绚丽的网页3D世界 -
shuiyunbing:
直接在前台导出方式:excel中的单元格样式怎么处理,比如某行 ...
Flex导出Excel -
di1984HIT:
写的很好~
lucene入门-索引网页 -
rjguanwen:
在win7 64位操作系统下,pygtk的Entry无法输入怎 ...
pygtk-entry -
ldl_xz:
http://www.9958.pw/post/php_exc ...
PHPExcel常用方法汇总(转载)
1、连接数据库
1)相关参数
help database
Database Toolbox
Version 3.7 (R2010a) 25-Jan-2010
General functions:
chkprops - Database object properties.
logintimeout - Set or get time allowed to establish database connection.
setdbprefs - Set preferences for database actions for handling null values.
Database Access functions:
database/catalogs - Get database catalog names.
database/clearwarnings - Clear warnings for database connection.
database/close - Close database connection.
database/columns - Get database table column names.
database/commit - Make database changes permanent.
database/database - Connect to database.
database/exec - Execute SQL statement and open cursor.
database/fetch - Import data into MATLAB using connection handle.
database/get - Get database property.
database/insert - Export MATLAB cell array data to database table.
database/isconnection - Detect if database connection is valid.
database/isreadonly - Detect if database connection is read-only.
database/ping - Get status information about database connection.
database/rollback - Undo database changes.
database/runstoredprocedure - Stored procedures with input and output parameters.
database/schemas - Get database schema names.
database/set - Set properties for database connection.
database/sql2native - Convert JDBC SQL grammar into system's native SQL grammar.
database/tables - Get database table names.
database/update - Replace data in database table with data from MATLAB cell array.
Database Cursor Access functions:
cursor/attr - Get attributes of columns in fetched data set.
cursor/close - Close cursor.
cursor/cols - Get number of columns in fetched data set.
cursor/columnnames - Get names of columns in fetched data set.
cursor/fetch - Import data into MATLAB.
cursor/get - Get property of cursor object.
cursor/querytimeout - Get time allowed for a database SQL query to succeed.
cursor/rows - Get number of rows in fetched data set.
cursor/set - Set RowLimit for cursor fetch.
cursor/width - Get width of column in fetched data set.
Database Toolbox Object functions:
dbtbx/dbtbx - Construct Database Toolbox object.
dbtbx/display - Database Toolbox object display method.
/dbtbx/subsasgn - Subscripted assignment for Database Toolbox object.
dbtbx/subsref - Subscripted reference for Database Toolbox object.
Database Toolbox Database MetaData functions:
dmd/bestrowid - Get database table unique row identifier.
dmd/columnprivileges - Get database column privileges.
dmd/columns - Get database table column names.
dmd/crossreference - Get information about primary and foreign keys.
dmd/dmd - Construct database metadata object.
dmd/exportedkeys - Get information about exported foreign keys.
dmd/get - Get database metadata properties.
dmd/importedkeys - Get information about imported foreign keys.
dmd/indexinfo - Get indices and statistics for database table.
dmd/primarykeys - Get primary key information for database table or schema.
dmd/procedurecolumns - Get catalog's stored procedure parameters and result columns.
dmd/procedures - Get catalog's stored procedures.
dmd/supports - Detect if property is supported by database metadata.
dmd/tableprivileges - Get database table privileges.
dmd/tables - Get database table names.
dmd/versioncolumns - Get automatically updated table columns.
Database Toolbox Driver functions:
driver/driver - Construct database driver object.
driver/get - Get database driver properties.
driver/isdriver - Detect if driver is a valid JDBC driver object.
driver/isjdbc - Detect if driver is JDBC-compliant.
driver/isurl - Detect if database URL is valid.
driver/register - Load database driver.
driver/unregister - Unload database driver.
Database Toolbox Drivermanager functions:
drivermanager/drivermanager - Construct database drivermanager object.
drivermanager/get - Get database drivermanager properties.
drivermanager/set - Set database drivermanager properties.
Database Toolbox Resultset functions:
resultset/clearwarnings - Clear the warnings for the resultset.
resultset/close - Close resultset object.
resultset/get - Get resultset properties.
resultset/isnullcolumn - Detect if last record read in resultset was null.
resultset/namecolumn - Map resultset column name to resultset column index.
resultset/resultset - Construct resultset object.
Database Toolbox Resultset MetaData functions:
rsmd/rsmd - Construct resultset metadata object.
rsmd/get - Get resultset metadata properties.
Database Toolbox bulk insert examples:
dbdemos/mssqlserverbulkinsert - MS SQL Server bulk insert example.
dbdemos/mysqlbulkinsert - MySQL bulk insert example.
dbdemos/oraclebulkinsert - Oracle bulk insert example.
Visual Query Builder functions:
vqb/confds - Configure data source (UNIX only).
vqb/getdatasources - Return valid data sources on system.
vqb/loginconnect - Datasource connection.
vqb/parsebinary - Write binary object to disk.
vqb/qbhelp - Query Builder help string.
vqb/querybuilder - Start visual SQL query builder.
vqb/showdata - Display data in interactive window.
vqb/showdatacallbacks - Visual Query Builder data display callbacks.
vqb/vqbdemo - Visual Query Builder demonstrations.
database is both a directory and a function.
DATABASE Connect to database.
CONNECT = DATABASE(INSTANCE,USERNAME,PASSWORD,DRIVER,DATABASEURL)
returns a database connection object. INSTANCE is the name of the
database, USERNAME is the user name. PASSWORD is the password
that permits access to the database. DRIVER is a JDBC driver name and
DATABASEURL is the URL for the database. The latter arguments are
optional but both must be used in conjunction with each other.
Use LOGINTIMEOUT before DATABASE to set the maximum time for a
connection attempt.
Example:
JDBC-ODBC connection:
conn=database('oracle','scott','tiger')
where:
'oracle' is the ODBC datasource name for an ORACLE database.
'scott' is the user name.
'tiger' is the password.
JDBC connection:
conn=database('oracle','scott','tiger',
'oracle.jdbc.driver.OracleDriver','jdbc:oracle:oci7:')
where:
'oracle' is the database name.
'scott' is the user name.
'tiger' is the password.
'oracle.jdbc.driver.OracleDriver' is the JDBC driver to be used
to make the connection.
'jdbc:oracle:oci7:' is the URL as defined by the Driver vendor
to establish a connection with the database.
See also close.
JDBC的driver 例子
IBM Informix
JDBC driver: com.informix.jdbc.IfxDriver
Database URL: jdbc:informix-sqli://161.144.202.206:3000:
INFORMIXSERVER=stars
MySQL
JDBC driver: twz1.jdbc.mysql.jdbcMysqlDriver
Database URL: jdbc:z1MySQL://natasha:3306/metrics
JDBC driver: com.mysql.jdbc.Driver
Database URL: jdbc:mysql://devmetrics.mrkps.com/testing
Oracle oci7 drivers
JDBC driver: oracle.jdbc.driver.OracleDriver
Database URL: jdbc:oracle:oci7:@rex
Oracle oci8 drivers
JDBC driver: oracle.jdbc.driver.OracleDriver
Database URL: jdbc:oracle:oci8:@111.222.333.44:1521:
Database URL: jdbc:oracle:oci8:@frug
Oracle thin drivers
JDBC driver: oracle.jdbc.driver.OracleDriver
Database URL: jdbc:oracle:thin:@144.212.123.24:1822:
Oracle 10 connections with JDBC (thin drivers)
JDBC driver: oracle.jdbc.driver.OracleDriver
Database URL: jdbc:oracle:thin: (do not specify the target name and port)
In this example, the target machine on which the database server resides is 144.212.123.24 and the port number is 1822.
PostgreSQL
JDBC driver: org.postgresql.Driver
Database URL: jdbc:postgresql://masd/MOSE
PostgreSQL with SSL connection
JDBC driver: org.postgresql.Driver
Database URL: jdbc:postgresql:servername:dbname:ssl=
true&sslfactory=org.postgresql.ssl.NonValidatingFactory& (the trailing & is required)
Microsoft SQL Server
JDBC driver: com.microsoft.jdbc.sqlserver.SQLServerDriver
Database URL: jdbc:microsoft:sqlserver://localhost:port;database=databasename
Note For MS SQL Server 2005, the Driver and URL syntax has changed to:
JDBC driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
Database URL: jdbc:sqlserver://localhost:port;database=databasename
Sybase SQL Server and Sybase SQL Anywhere
JDBC driver: com.sybase.jdbc.SybDriver
Database URL: jdbc:sybase:Tds:yourhostname:yourportnumber/
JDBC连接数据库的参数:
conn = database('databasename','username',...
'password','driver','databaseurl') connects a MATLAB software session to a database and assigns the returned connection object to conn. The arguments passed to this function are as follows:
databasename: The name of the database to which you connect.
driver: The name of your JDBC driver.
Note The JDBC driver is sometimes referred to as the class that implements the Sun Java SQL driver for your database.
username and password: The user name and password required to connect to the database. If a user name or password are not required to connect to your database, specify empty strings for these arguments.
Find the correct driver name
databaseurl: A JDBC URL object of the form jdbc:subprotocol:subname. subprotocol is a database type, such as Oracle. subname may contain other information used by driver, such as the location of the database and/or a port number. subname may take the form //hostname:port/databasename.
If database establishes a database connection, it returns information about the connection object, as shown in the following example:
Instance: 'SampleDB'
UserName: ''
Driver: []
URL: []
Constructor: [1x1 com.mathworks.toolbox.database.databaseConnect]
Message: []
Handle: [1x1 sun.jdbc.odbc.JdbcOdbcConnection]
TimeOut: 0
AutoCommit: 'off'
Type: 'Database Object'
2)连接mysql
a)如果是测试开发用,可以下载安装xampp
http://www.apachefriends.org/zh_cn/xampp-windows.html
b)安装JDBC驱动
http://dev.mysql.com/downloads/mirror.php?id=408558
安装mysql驱动程序包,详细步骤如下:
Step 1: 将mysql-connector-java-5.1.21-bin.jar文件拷贝到......MATLAB\R2011b\java\jar\toolbox
Step 2: 到......\MATLAB\R2009a\toolbox\local目录下,找到classpath.txt文件,打开,并添加用来加载mysql的jdbc驱动语句:
$matlabroot/java/jar/toolbox/mysql-connector-java-5.1.21-bin.jar
Step 3:重新打开MATLAB即可
c)编写代码连接
myconn=database('test','root','','com.mysql.jdbc.Driver','jdbc:mysql://localhost:3306/test')
myconn =
Instance: 'test'
UserName: 'root'
Driver: 'com.mysql.jdbc.Driver'
URL: 'jdbc:mysql://localhost:3306/test'
Constructor: [1x1 com.mathworks.toolbox.database.databaseConnect]
Message: []
Handle: [1x1 com.mysql.jdbc.JDBC4Connection]
TimeOut: 0
AutoCommit: 'on'
Type: 'Database Object'
>> ping(myconn)
ans =
DatabaseProductName: 'MySQL'
DatabaseProductVersion: '5.5.25a'
JDBCDriverName: 'MySQL-AB JDBC Driver'
JDBCDriverVersion: [1x60 char]
MaxDatabaseConnections: 0
CurrentUserName: 'root@localhost'
DatabaseURL: 'jdbc:mysql://localhost:3306/test'
AutoCommitTransactions: 'True'
设置连接超时时限
>> logintimeout('com.mysql.jdbc.Driver',10)
ans =
10
>>
发表评论
-
R语言与数据分析
2015-05-15 20:58 2161当今计算机系统要处理的数据类型变得多种多样,并且为了深入理 ... -
机器学习实践指南:案例应用解析
2014-04-17 19:53 1005试读及购买链接 《机器 ... -
matlab-矩阵合并
2013-06-10 13:56 3230a = 1 2 3 2 -
人工智能与数据分析所需要的知识
2013-04-30 18:27 292想较好得在数据分析和人工智能相关领域发展,最好具备以下基础: ... -
麦哈普的AI乐园【myhaspl@qq.com】我的另一个博客(机器学习、数据分析、智能计算的原创)
2013-04-28 10:52 11http://blog.csdn.net/u0102556 ... -
R-并行计算
2013-04-28 10:50 6126啊。。。找了一下,R 居然真的有办法可以多cpu平行运算!! ... -
谱聚类
2013-04-11 10:44 27301. 谱聚类 给你博客园上若干个博客,让你将它 ... -
对变化建模-用差分方程-动力系统及常数解
2013-04-09 15:24 1385差分表示在一个时间周期里考察对象的变化量。 差分表示在一个时 ... -
逻辑斯蒂映射-伪随机数
2013-04-04 15:28 3310逻辑斯蒂映射的形式为 x_(n+1)=ax_n( ... -
matlab-多项式乘除法及式子和导数
2013-03-21 15:06 4704>> a=[22 12 4 54] ... -
matlab-数组-元胞数据与结构数组
2013-03-20 17:45 3296y、z是元胞数组,num2cell完成由数值数组到元胞数组的 ... -
矩阵-范数
2013-03-13 17:30 1926>> a a = 12 33 ... -
向量-范数
2013-03-13 16:06 2374>> b=a(3,:) b = 22 ... -
矩阵-求逆
2013-02-27 15:51 2525设R是一个交换环,A是 ... -
lisp-猜数字算法与全局函数、变量
2013-01-30 17:55 1608* (defvar *big* 100) *BIG* ... -
开源 Lisp 相关项目
2013-01-19 22:38 3931IOLib 项目 (http://common-lisp.n ... -
四分位数求法
2012-11-22 20:18 2793四分位数间距:是上四分位数与下四分位数之差,用四分位数间距可反 ... -
matlab-神经网络-自定义多层感知器解决异或(2)
2012-10-10 22:33 2509继续定义单元神经元 net.inputs{i}.ran ... -
matlab-神经网络-自定义多层感知器解决异或(1)
2012-10-09 22:41 5251>> net=network net = ... -
matlab-模态对话框
2012-10-05 16:59 3537modal dialog box with the comm ...
相关推荐
MATLAB提供了多种数据库连接工具,如Database Toolbox,使得用户可以方便地连接到各种类型的数据库,如SQL Server、Oracle、MySQL等。使用这些工具,我们可以创建数据库连接,执行SQL语句,以及读取和写入数据。 在...
总的来说,MATLAB数据库工具箱结合Matlabadt库,为音频数据的分析和处理提供了一个强大且灵活的环境,使得研究人员和开发人员能够专注于他们的核心任务,而不必过多关注底层的数据库操作。无论是简单的数据检索还是...
将 Matlab 与 PostgreSQL 数据库连接起来,可以实现数据的高效交互和分析。本文将详细介绍 Matlab 与 PostgreSQL 数据库的连接方法。 知识点:Matlab 的数据库连接 Matlab 提供了多种方式来连接数据库,其中包括...
这通常涉及数据库连接、查询和数据提取,是大型数据处理的关键步骤。 4. **README.m** 和 **README.pdf**:这些文件提供了关于项目的基本信息和使用指南。它们通常包含了如何运行代码、所需环境、依赖项以及可能的...
在进行MATLAB数据库开发时,理解基本的数据库连接和查询方法,以及如何利用自定义工具如`MYM.M`,将极大地提高你的工作效率。确保遵守许可证规定,并合理利用提供的辅助工具,将使你在MATLAB数据库编程中游刃有余。
matlab与sql数据库连接,实例说明,M文件
一、Matlab数据库连接概述 Matlab提供了一种灵活的接口,使得用户能够直接在Matlab环境中操作各种类型的数据库,包括关系型数据库如Oracle、MySQL、SQL Server,以及非关系型数据库如MongoDB等。通过内置的Database...
综上所述,MATLAB与数据库的连接涉及到数据库技术的基础应用、MATLAB的数据处理能力、远程数据库连接的设置、编程环境的配置、数据获取方法、以及MATLAB Database工具箱的具体应用。通过对这些知识点的理解和应用,...
开发基于外部数据源的MATLAB数据库涉及的关键技术是ODBC(开放式数据库连接)。 ODBC作为数据库应用的接口,为不同的数据库管理系统提供了一个统一的数据库接口标准。它由三部分组成:API(应用程序接口)、驱动...
标题中的“Matlab与数据库连接”指的是在MATLAB环境下如何与数据库进行交互,实现数据的导入和导出。MATLAB是一种强大的数值计算和数据分析工具,它提供了与多种类型数据库(如Access)连接的功能,以便于在MATLAB...
在MATLAB中进行数据库连接是开发过程中的一个重要环节,特别是在处理和分析大量数据时。"A制冷数据库连接"这个项目可能涉及到将MATLAB与特定的制冷行业相关的数据库系统相结合,以便进行数据查询、分析和存储操作。...
基于外部数据源的MATLAB数据库开发** 外部数据源通常指的是通过ODBC(Open Database Connectivity)接口连接的数据库。ODBC是一个标准的API,允许不同的DBMS之间进行通信。MATLAB通过ODBC-JDBC桥接器与数据库建立...
其中,conn 是数据库连接对象,'select * from table1' 是要执行的 SQL 语句。 接下来,可以使用 fetch 函数来获取查询结果: curs = fetch(curs) 最后,可以使用 data 属性来获取查询结果: cur = curs.data ...
这涉及到MATLAB的数据库连接函数,如`database`,以及相关的配置步骤,包括创建数据源(DSN)和设置连接参数。 2. SQL语言的运用:SQL(Structured Query Language)是用于管理和处理关系型数据库的标准语言。在...
1. **连接数据库**:MATLAB支持多种数据库接口,如ODBC(开放数据库连接)和JDBC(Java数据库连接)。首先,脚本会使用`database`函数建立到数据库服务器的连接,定义数据库类型、服务器地址、用户名、密码等参数。 ...
MATLAB提供了与多种数据库连接的功能,包括ODBC(Open Database Connectivity)接口,使得数据交换变得更加方便。 首先,建立数据库是整个过程的基础。这里以Access数据库为例,你需要在Access中创建一个新的数据库...
最后,`close`函数用于关闭游标和数据库连接,释放资源。 除了基本的连接和查询,MATLAB还支持更复杂的数据库操作,如插入、更新和删除数据,以及事务处理。例如,你可以使用`insert`, `update`, `delete`等SQL命令...
2. **MATLAB代码实现**:在MATLAB中,你可以使用`database`函数创建一个数据库连接对象,该对象使用DSN作为参数。例如: ```matlab conn = database('DSN_NAME','USER_ID','PASSWORD'); ``` 其中,'DSN_NAME'是...
总的来说,MATLAB GUI与数据库Access的编程涉及数据库连接、SQL查询、GUI组件的回调函数、数据处理和用户交互等多个方面。通过熟练掌握这些技术,可以构建出高效、易用的数据管理应用。在实际项目中,应考虑性能优化...