java连接池使用方法二
2004-12-01 23:40
696 查看
使用方法:
连接sqlserver:
Class.forName("net.sourceforge.jtds.jdbc.Driver").newInstance();
String url ="jdbc:jtds:sqlserver://localhost:1433/check";//check是数据库名
cnn = DriverManager.getConnection(url, user, password);
它的帮助 是这样写的:
driver:net.sourceforge.jtds.jdbc.Driver
url:
The URL format for jTDS is:
jdbc:jtds:<server_type>://<server>[:<port>][/<database>][;<property>=<value>[;...]]
where <server_type> is one of either 'sqlserver' or 'sybase' (their meaning is quite obvious), <port> is the port the database server is listening to (default is 1433 for SQL Server and 7100 for Sybase) and <database> is the database name -- JDBC term: catalog -- (if not specified, the user's default database is used). The set of properties supported by jTDS is:
user (required)
User name to use for login. When using getConnection(String url, String user, String password) it's not required to set this property as it is passed as parameter, but you will have to set it when using getConnection(String url, Properties info) or TdsDataSource.
password (required)
Password to use for login. When using getConnection(String url, String user, String password) it's not required to set this property as it is passed as parameter, but you will have to set it when using getConnection(String url, Properties info) or TdsDataSource.
这是用于sybase或者sqlserver的,其它数据库你还要看它的文档
-------------------------------------------------------------------------------------
文章地址:http://community.csdn.net/Expert/topic/3589/3589555.xml?temp=.952572
连接sqlserver:
Class.forName("net.sourceforge.jtds.jdbc.Driver").newInstance();
String url ="jdbc:jtds:sqlserver://localhost:1433/check";//check是数据库名
cnn = DriverManager.getConnection(url, user, password);
它的帮助 是这样写的:
driver:net.sourceforge.jtds.jdbc.Driver
url:
The URL format for jTDS is:
jdbc:jtds:<server_type>://<server>[:<port>][/<database>][;<property>=<value>[;...]]
where <server_type> is one of either 'sqlserver' or 'sybase' (their meaning is quite obvious), <port> is the port the database server is listening to (default is 1433 for SQL Server and 7100 for Sybase) and <database> is the database name -- JDBC term: catalog -- (if not specified, the user's default database is used). The set of properties supported by jTDS is:
user (required)
User name to use for login. When using getConnection(String url, String user, String password) it's not required to set this property as it is passed as parameter, but you will have to set it when using getConnection(String url, Properties info) or TdsDataSource.
password (required)
Password to use for login. When using getConnection(String url, String user, String password) it's not required to set this property as it is passed as parameter, but you will have to set it when using getConnection(String url, Properties info) or TdsDataSource.
这是用于sybase或者sqlserver的,其它数据库你还要看它的文档
-------------------------------------------------------------------------------------
文章地址:http://community.csdn.net/Expert/topic/3589/3589555.xml?temp=.952572
相关文章推荐
- Java实现时间日期格式转换示例
- Apache+PHP4.0+Sybase安装文档
- Java下利用Jackson进行JSON解析和序列化示例
- Java的几个重要版本_动力节点Java学院整理
- Java Web开发之信息查询方式总结
- 基于Java字符编码的使用详解
- java获取Date时间的各种方式汇总
- Java使用AES加密和解密的实例详解
- 基于java时区转换夏令时的问题及解决方法
- 转 -- Java 学习方法浅谈 --来自java视线 Robbin
- ORACLE9i连接SYBASE的透明网关的配置
- OpenOffice,好用的开源办公软件
- c#接简单数据库操作类
- Java测试规范(引用)
- Hibernate Tool & Files
- How to disable JIT for JVM
- Java面试题目