数据库连接参数

一、Microsoft Excel

1  Microsoft ACE OLEDB 12.0

1.1  Xlsx files

Connect to Excel 2007 (and later) files with the Xlsx file extension. That is the Office Open XML format with macros disabled.

Provider=Microsoft.ACE.OLEDB.12.0;Data Source=c:\myFolder\myExcel2007file.xlsx;Extended Properties="Excel 12.0 Xml;HDR=YES";

"HDR=Yes;" indicates that the first row contains columnnames, not data. "HDR=No;" indicates the opposite.

1.2  Treating data as text

Use this one when you want to treat all data in the file as text, overriding Excels column type "General" to guess what type of data is in the column.

Provider=Microsoft.ACE.OLEDB.12.0;Data Source=c:\myFolder\myExcel2007file.xlsx;Extended Properties="Excel 12.0 Xml;HDR=YES;IMEX=1";
  • If you want to read the column headers into the result set (using HDR=NO even though there is a header) and the column data is numeric, use IMEX=1 to avoid crash.
  • To always use IMEX=1 is a safer way to retrieve data for mixed data columns. Consider the scenario that one Excel file might work fine cause that file‘s data causes the driver to guess one data type while another file, containing other data, causes the driver to guess another data type. This can cause your app to crash.

1.3  Xlsm files

Connect to Excel 2007 (and later) files with the Xlsm file extension. That is the Office Open XML format with macros enabled.

Provider=Microsoft.ACE.OLEDB.12.0;Data Source=c:\myFolder\myExcel2007file.xlsm;Extended Properties="Excel 12.0 Macro;HDR=YES";

1.4  Excel 97-2003 Xls files with ACE OLEDB 12.0

You can use this connection string to use the Office 2007 OLEDB driver (ACE 12.0) to connect to older 97-2003 Excel workbooks.

Provider=Microsoft.ACE.OLEDB.12.0;Data Source=c:\myFolder\myOldExcelFile.xls;Extended Properties="Excel 8.0;HDR=YES";
时间: 2024-08-25 12:14:10

数据库连接参数的相关文章

NHibernate各种数据库连接参数文件配置方法说明

//NHibernate各种数据库连接参数文件配置方法说明 //配置文件Config/Hibernate.cfg.xml内容如下所示:<?xml version="1.0" encoding="utf-8" ?><hibernate-configuration  xmlns="urn:nhibernate-configuration-2.2" >  <session-factory name="CwfSer

swing开发一个修改项目数据库连接参数配置文件

我们在开发web项目中,经常有properties配置文件配置数据库连接参数,每次修改的时候还要去找到配置文件,感觉有点麻烦,就用swing做了个小工具修改参数,运行界面如下: ============================================================== 一.项目结构: 二.相关代码: 1.ConfigTools.java package com.xie.main; import java.awt.BorderLayout; import java

JDBC数据库连接参数备忘

database driver url remark MySql com.mysql.jdbc.Driver jdbc:mysql://localhost:3306/xxx mysql-connector-java 5 MySql com.mysql.cj.jdbc.Driver jdbc:mysql://localhost:3306/xxx?serverTimezone=UTC mysql-connector-java 6 SQLServer2005+ com.microsoft.sqlser

NHibernate数据库配置文件介绍及多数据库连接简介

编写配置文件 <?xml version="1.0" encoding="utf-8" ?><hibernate-configuration  xmlns="urn:nhibernate-configuration-2.2" >  <session-factory name="NJ12369.SendInfo">    <!-- properties -->    <pro

Spring+SpringMVC+MyBatis+easyUI整合基础篇(七)JDBC url的连接参数

在java程序与数据库连接的编程中,mysql jdbc url格式如下: jdbc:mysql://[host:port],[host:port].../[database][?参数名1][=参数值1][&参数名2][=参数值2]... 如 jdbc:mysql://localhost:3306/test?user=test&password=123456 刚好最近遇到一个数据库连接参数带来的问题,所以罗列一下几个较为重要的参数: user 数据库用户名(用于连接数据库) 必要参数. p

Django模型开发 --python数据库连接

在Django中,视图负责处理一些业务逻辑,然后返回响应结果.在当代Web应用中,业务逻辑经常牵涉到与数据库的交互,在后台连接数据库服务器,从中取出一些数据,然后在Web页面用漂亮的格式展示这些数据.这个网站也可能会向访问者提供修改数据库数据的方法. 在这一篇博文中,我们将以MySQL数据库为例,先看看不使用Django模型的数据库查询方法,然后开始学习Django的模型. 1. 不使用模型的数据库查询方法 假如我们不采用Django的模型,如何从数据库中获取数据呢?通常的做法就是在视图(Vie

NHibernate4使用Oracle.ManagedDataAccess.dll连接oracle及配置多个数据库连接

NHibernate数据库配置参数在hibernate.cfg.xml中 <?xml version="1.0" encoding="utf-8"?> <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2"> <session-factory name="ora10gFactory"> <!--<prop

通过.ENV文件来配置ThinkPHP的数据库连接信息

在ThinkPHP系统根目录创建.env文件,注意WINDOWS无法直接右键创建,使用编辑器保存时设置文件名为.env就可以创建文件.内容如下: .evn文件内容如下: [database] hostname = localhost database = vxianfeng username = root password = root hostport = 3306 prefix = vxf_ 应用程序目录创建 database.php内容如下 return [ // 数据库类型 'type'

thinkphp数据库连接

https://www.kancloud.cn/manual/thinkphp5/118059 一.配置文件定义 常用的配置方式是在应用目录或者模块目录下面的database.php中添加下面的配置参数: return [ // 数据库类型 'type' => 'mysql', // 数据库连接DSN配置 'dsn' => '', // 服务器地址 'hostname' => '127.0.0.1', // 数据库名 'database' => 'thinkphp', // 数据库