- 浏览: 4915735 次
- 性别:
- 来自: 上海
文章分类
- 全部博客 (743)
- JAVA (44)
- JAVA 乔乐共享 (145)
- js (132)
- database (26)
- jQuery (46)
- velocity (16)
- Ubuntu (14)
- Grails (2)
- Groovy (6)
- xml (2)
- Spring (11)
- mysql (24)
- sqlserver (6)
- oracle (9)
- cmd (8)
- CSS (17)
- Linux (2)
- sqlite (4)
- php (11)
- json (2)
- laravel (2)
- html (3)
- 闲聊 (3)
- git (13)
- nodejs (25)
- angularjs (17)
- npm (8)
- bootstrap (4)
- mongodb (5)
- React (32)
- Crack (7)
- b (0)
- ES6 (2)
- webpack (3)
- Babel (1)
- Koa (1)
最新评论
-
taoshengyijiuzt:
感谢大佬!!!
JetBrains最新激活服务器(长期更新ing) -
masuweng:
激活码可以用
JetBrains最新激活服务器(长期更新ing) -
dusdong:
都失效了
JetBrains最新激活服务器(长期更新ing) -
追风筝的孩纸Zz:
dddddddddddddddd
js获取网页屏幕可见区域高度 -
自己811005:
88350bcf69dcfbda7f8a76a589d9054 ...
Js设置前端允许跨域请求后端API:Access-Control-Allow-Credentials
ConnectHSQLDB.java
ConnectMySQL.java
Connect MS SQL Server
Connect Oracle
Connect DB2
Connect Postgre
Connect ADS
Connect Derby
Connect Firebird
Connect H2
Connect SQLite
Connect SmallSQL
http://www.javaworkspace.com/donations.do
/** * ConnectHSQLDB.java */ package com.javaworkspace.connecthsqldb; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; /** * @author www.javaworkspace.com * */ public class ConnectHSQLDB { public static void main(String[] args) { Connection connection = null; ResultSet resultSet = null; Statement statement = null; try { Class.forName("org.hsqldb.jdbcDriver"); connection = DriverManager.getConnection( "jdbc:hsqldb:file:C:\\HyperSQLDB\\EMPLOYEEDB", "SA", ""); statement = connection.createStatement(); resultSet = statement .executeQuery("SELECT EMPNAME FROM EMPLOYEEDETAILS"); while (resultSet.next()) { System.out.println("EMPLOYEE NAME:" + resultSet.getString("EMPNAME")); } } catch (Exception e) { e.printStackTrace(); } finally { try { resultSet.close(); statement.close(); connection.close(); } catch (Exception e) { e.printStackTrace(); } } } }
ConnectMySQL.java
/** * ConnectMySQL.java */ package com.javaworkspace.connectmysql; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; /** * @author www.javaworkspace.com * */ public class ConnectMySQL { public static void main(String[] args) { try { Class.forName("com.mysql.jdbc.Driver"); Connection connection = DriverManager.getConnection( "jdbc:mysql://localhost:3306/EMPLOYEE", "root", "root"); Statement statement = connection.createStatement(); ResultSet resultSet = statement .executeQuery("SELECT EMPNAME FROM EMPLOYEEDETAILS"); while (resultSet.next()) { System.out.println("EMPLOYEE NAME:" + resultSet.getString("EMPNAME")); } } catch (Exception e) { e.printStackTrace(); } } }
Connect MS SQL Server
/** * ConnectMSSQL.java */ package com.javaworkspace.connectmssql; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; /** * @author www.javaworkspace.com * */ public class ConnectMSSQL { public static void main(String[] args) { try { Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); Connection connection = DriverManager .getConnection( "jdbc:sqlserver://localhost:1433;databaseName=EMPLOYEE;selectMethod=cursor", "username", "password"); System.out.println("DATABASE NAME IS:" + connection.getMetaData().getDatabaseProductName()); Statement statement = connection.createStatement(); ResultSet resultSet = statement .executeQuery("SELECT EMPNAME FROM EMPLOYEEDETAILS"); while (resultSet.next()) { System.out.println("EMPLOYEE NAME:" + resultSet.getString("EMPNAME")); } } catch (Exception e) { e.printStackTrace(); } } }
// Connect using JDTS driver /** * ConnectMSSQL.java */ package com.javaworkspace.connectmssql; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; /** * @author www.javaworkspace.com * */ public class ConnectMSSQL { public static void main(String[] args) { try { Class.forName("net.sourceforge.jtds.jdbc.Driver"); Connection connection = DriverManager .getConnection( "jdbc:jtds:sqlserver://localhost:1433;databaseName=EMPLOYEE;sendStringParametersAsUnicode=false", "username", "password"); System.out.println("DATABASE NAME IS:" + connection.getMetaData().getDatabaseProductName()); Statement statement = connection.createStatement(); ResultSet resultSet = statement .executeQuery("SELECT EMPNAME FROM EMPLOYEEDETAILS"); while (resultSet.next()) { System.out.println("EMPLOYEE NAME:" + resultSet.getString("EMPNAME")); } } catch (Exception e) { e.printStackTrace(); } } }
Connect Oracle
/** * ConnectOracle.java */ package com.javaworkspace.connectoracle; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; /** * @author www.javaworkspace.com * */ public class ConnectOracle { public static void main(String[] args) { try { DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver()); System.out.println("Connecting to the database..."); Connection connection = DriverManager.getConnection( "jdbc:oracle:thin:@localhost:1521:orcl", "scott", "tiger"); Statement statement = connection.createStatement(); ResultSet resultset = statement.executeQuery("select 'Connected' from dual"); resultset.next(); String s = resultset.getString(1); System.out.println(s); statement.close(); connection.close(); } catch (Exception e) { System.out.println("The exception raised is:" + e); } } }
Connect DB2
/** * ConnectDB2.java */ package com.javaworkspace.connectdb2; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; /** * @author www.javaworkspace.com * */ public class ConnectDB2 { public static void main(String[] args) { Connection connection = null; ResultSet resultSet = null; Statement statement = null; try { Class.forName("com.ibm.db2.jcc.DB2Driver"); connection = DriverManager.getConnection( "jdbc:db2://localhost:5021/EMPLOYEE", "username", "password"); statement = connection.createStatement(); resultSet = statement .executeQuery("SELECT EMPNAME FROM EMPLOYEEDETAILS"); while (resultSet.next()) { System.out.println("EMPLOYEE NAME:" + resultSet.getString("EMPNAME")); } } catch (Exception e) { e.printStackTrace(); } finally { try { resultSet.close(); statement.close(); connection.close(); } catch (Exception e) { e.printStackTrace(); } } } }
Connect Postgre
/** * ConnectPostgre.java */ package com.javaworkspace.connectpostgre; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; /** * @author www.javaworkspace.com * */ public class ConnectPostgre { public static void main(String[] args) { Connection connection = null; ResultSet resultSet = null; Statement statement = null; try { Class.forName("org.postgresql.Driver"); connection = DriverManager.getConnection( "jdbc:postgresql://localhost:5432/EMPLOYEE", "postgres", "password"); statement = connection.createStatement(); resultSet = statement .executeQuery("SELECT EMPNAME FROM EMPLOYEEDETAILS"); while (resultSet.next()) { System.out.println("EMPLOYEE NAME:" + resultSet.getString("EMPNAME")); } } catch (Exception e) { e.printStackTrace(); } finally { try { resultSet.close(); statement.close(); connection.close(); } catch (Exception e) { e.printStackTrace(); } } } }
Connect ADS
/** * ConnectADS.java */ package com.javaworkspace.connectads; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; /** * @author www.javaworkspace.com * */ public class ConnectADS { public static void main(String[] args) { Connection connection = null; ResultSet resultSet = null; Statement statement = null; try { Class.forName("com.extendedsystems.jdbc.advantage.ADSDriver"); connection = DriverManager.getConnection( "jdbc:extendedsystems:advantage://localhost:6262;catalog=C:\\yourDatbase\\data;TableType=cdx;LockType=proprietary", "AdsSys", "no"); statement = connection.createStatement(); resultSet = statement .executeQuery("SELECT EMPNAME FROM EMPLOYEEDETAILS"); while (resultSet.next()) { System.out.println("EMPLOYEE NAME:" + resultSet.getString("EMPNAME")); } } catch (Exception e) { e.printStackTrace(); } finally { try { resultSet.close(); statement.close(); connection.close(); } catch (Exception e) { e.printStackTrace(); } } } }
Connect Derby
/** * ConnectDerby.java */ package com.javaworkspace.connectderby; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; /** * @author www.javaworkspace.com * */ public class ConnectDerby { public static void main(String[] args) { Connection connection = null; ResultSet resultSet = null; Statement statement = null; try { Class.forName("org.apache.derby.jdbc.EmbeddedDriver"); connection = DriverManager .getConnection("jdbc:derby:C:/DerbyDatabase/EMPLOYEE"); statement = connection.createStatement(); resultSet = statement .executeQuery("SELECT EMPNAME FROM EMPLOYEEDETAILS"); while (resultSet.next()) { System.out.println("EMPLOYEE NAME:" + resultSet.getString("EMPNAME")); } } catch (Exception e) { e.printStackTrace(); } finally { try { resultSet.close(); statement.close(); connection.close(); } catch (Exception e) { e.printStackTrace(); } } } }
Connect Firebird
/* * ConnectFirebirdDB.java */ package com.javaworkspace.connectfirebirddb; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; /** * @author www.javaworkspace.com * */ public class ConnectFirebirdDB { public static void main(String[] args) { Connection connection = null; ResultSet resultSet = null; Statement statement = null; try { Class.forName("org.firebirdsql.jdbc.FBDriver"); connection = DriverManager .getConnection( "jdbc:firebirdsql://localhost:3050/C:/FirebirdDB/EMPLOYEEDB.fdb", "sysdba", "masterkey"); statement = connection.createStatement(); resultSet = statement .executeQuery("SELECT EMPNAME FROM EMPLOYEEDETAILS"); while (resultSet.next()) { System.out.println("EMPLOYEE NAME:" + resultSet.getString("EMPNAME")); } } catch (Exception e) { e.printStackTrace(); } finally { try { resultSet.close(); statement.close(); connection.close(); } catch (Exception e) { e.printStackTrace(); } } } }
Connect H2
/* * ConnectH2DB.java */ package com.javaworkspace.connecth2db; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; /** * @author www.javaworkspace.com * */ public class ConnectH2DB { public static void main(String[] args) { Connection connection = null; ResultSet resultSet = null; Statement statement = null; try { Class.forName("org.h2.Driver"); connection = DriverManager.getConnection( "jdbc:h2:C:\\H2DB\\database\\EMPLOYEEDB", "sa", ""); statement = connection.createStatement(); resultSet = statement .executeQuery("SELECT EMPNAME FROM EMPLOYEEDETAILS"); while (resultSet.next()) { System.out.println("EMPLOYEE NAME:" + resultSet.getString("EMPNAME")); } } catch (Exception e) { e.printStackTrace(); } finally { try { resultSet.close(); statement.close(); connection.close(); } catch (Exception e) { e.printStackTrace(); } } } }
Connect SQLite
/** * ConnectSQLite.java */ package com.javaworkspace.connectsqlite; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; /** * @author www.javaworkspace.com * */ public class ConnectSQLite { public static void main(String[] args) { Connection connection = null; ResultSet resultSet = null; Statement statement = null; try { Class.forName("org.sqlite.JDBC"); connection = DriverManager .getConnection("jdbc:sqlite:C:\\SQLite\\EMPLOYEE.db"); statement = connection.createStatement(); resultSet = statement .executeQuery("SELECT EMPNAME FROM EMPLOYEEDETAILS"); while (resultSet.next()) { System.out.println("EMPLOYEE NAME:" + resultSet.getString("EMPNAME")); } } catch (Exception e) { e.printStackTrace(); } finally { try { resultSet.close(); statement.close(); connection.close(); } catch (Exception e) { e.printStackTrace(); } } } }
Connect SmallSQL
/** * ConnectSmallSQL.java */ package com.javaworkspace.connectsmallsql; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; /** * @author www.javaworkspace.com * */ public class ConnectSmallSQL { public static void main(String[] args) { Connection connection = null; ResultSet resultSet = null; Statement statement = null; try { Class.forName("smallsql.database.SSDriver"); connection = DriverManager .getConnection("jdbc:smallsql:C:\\SmallSQL\\database\\EMPLOYEEDB"); statement = connection.createStatement(); resultSet = statement .executeQuery("SELECT EMPNAME FROM EMPLOYEEDETAILS"); while (resultSet.next()) { System.out.println("EMPLOYEE NAME:" + resultSet.getString("EMPNAME")); } } catch (Exception e) { e.printStackTrace(); } finally { try { resultSet.close(); statement.close(); connection.close(); } catch (Exception e) { e.printStackTrace(); } } } }
http://www.javaworkspace.com/donations.do
发表评论
-
MySQL插入emoji手机表情报错解决方案
2018-01-25 23:43 2940报错原因: ps:为什么没有内容呢,由于iteye插入e ... -
nodejs同步操作mysql
2014-10-29 15:23 5507// db-util.js var mysql = re ... -
Pl/sql 连接 Oracle ‘SQL*Net not properly installed OracleHomeKey:SOFTWARE\ORACLE’
2014-09-17 18:17 11352安装好Oracle和pl/sql后,用pl/sql连接Or ... -
[Warning] TIMESTAMP with implicit DEFAULT value is depreca
2014-05-02 09:50 24948C:\Users\Happy>mysqld --co ... -
wampserver IP访问被禁止解除
2014-04-29 16:43 1921// 点击Apache下面的httpd.conf 修改 ... -
php读取mysql中文乱码解决
2014-04-29 14:54 4579<!DOCTYPE> <html> ... -
mysql查询或更新单双数字的内容
2013-11-19 17:27 1040select * from tbl_name where ... -
mysql复制表结构或者表数据,可备份数据
2013-11-19 17:26 1854If the destination table alrea ... -
sql查询最后一条自增长的记录
2013-11-13 17:21 1240mysql> select * from messag ... -
mysql安装服务绿色版
2013-10-04 16:03 10341)首先安装mysql http://qiaolevip ... -
安装绿色版mysql-5.6.14
2013-10-04 16:00 35581)下载www.mysql.com mysql安装程序,my ... -
mysql注册服务或移除服务
2013-07-26 15:01 1306--注册系统服务 mysqld --install mys ... -
DB2,Mysql,Sqlserver,oracle分页算法,分页语句
2013-03-07 20:43 1667Mysql limit = ((feeds.getPage ... -
DB2 分页,row_number分页
2013-03-07 16:59 1969select * from (select ROW_N ... -
mysql查询每月不重复的数据
2012-10-15 11:14 4802mysql> select * from produ ... -
mysql统计多表交叉组合总数
2012-10-11 11:33 5357>mysql -h localhost -u root ... -
DB2获取当前时间
2012-09-20 14:05 12268SELECT current date FROM sysi ... -
DB2 查看表结构,DB2查看所用表
2012-09-20 09:58 5124查看所用表(注:条件内容需要大写) select * fr ... -
hsql创建自动增长列并授权数据库
2012-08-26 10:09 1616ID INTEGER GENERATED BY DEFAU ... -
Mysql各种报表查询含实例,日报,周报,月报,时间差自动计算
2012-04-12 11:28 7556public List<IReport> re ...
相关推荐
DBeaver是一款基于Java开发的通用数据库管理工具和SQL客户端,支持MySQL、PostgreSQL、Oracle、DB2、MSSQL、Sybase、Mimer、HSQLDB、Derby以及其他兼容JDBC的数据库。DBeaver提供了图形界面用来查看数据库结构、执行...
### 使用Hibernate连接各种数据库的方法 #### 一、前言 Hibernate是Java开发中非常流行的ORM(对象关系映射)框架之一,它简化了数据库操作,让开发者能够更加专注于业务逻辑而不是复杂的SQL语句编写。本文将详细...
本文档将详细介绍如何使用Java来连接各种主流数据库,包括Oracle、SQL Server、DB2、Informix、Sybase、MySQL、PostgreSQL、SAPDB、InterBase以及HSQLDB。 #### 二、连接Oracle数据库 要连接Oracle数据库,首先...
jar使用说明: 驱动 对应数据库 --------------------------------------...mysql-connector-java-5.1.6-bin.jar Mysql数据库 ---------------------------------------------------------- sybase.jar Sybase数据库
Hibernate是一个开源的对象关系映射(ORM)框架,用于Java应用与各种关系型数据库进行交互。它提供了强大的功能,如对象持久化、查询语言支持、事务管理等,大大简化了数据访问层的开发工作。 ### Hibernate支持的...
MySQL、Oracle、PostgreSQL、IBM DB2、Microsoft SQL Server、clickhouse、Sybase、ODBC、Java DB (Derby)、Firebird (Interbase)、HSQLDB、SQLite、Mimer、H2、IBM Informix、SAP MAX DB、Cache、Ingres、Linter、...
常见的数据库产品有Oracle、SQL Server、DB2、Sybase、Informix、MySQL、hsqldb、InterBase等,以及更贴近个人用户级别的Foxpro、Access和Excel。 数据库对象是数据库中的基本元素,如表(table)、字段(column)...
- 关系型数据库(RDBMS):例如Oracle、MySQL、SQL Server、DB2、HSQLDB、Derby等。它们使用二维表结构存储数据,并通过关系代数进行操作。 - 对象型数据库(OODBMS):以对象作为数据存储的基本单位。 - NoSQL...
MySQL、Oracle、PostgreSQL、IBM DB2、Microsoft SQL Server、clickhouse、Sybase、ODBC、Java DB (Derby)、Firebird (Interbase)、HSQLDB、SQLite、Mimer、H2、IBM Informix、SAP MAX DB、Cache、Ingres、Linter、...
H2还兼容多种数据库系统,包括IBM DB2、Apache Derby、HSQLDB、MS SQL Server、MySQL、Oracle和PostgreSQL等,这使得迁移至H2时更容易上手。 #### 安全属性 H2在安全方面做了大量工作,包括但不限于: - 提供针对...
MySQL、Oracle、PostgreSQL、IBM DB2、Microsoft SQL Server、clickhouse、Sybase、ODBC、Java DB (Derby)、Firebird (Interbase)、HSQLDB、SQLite、Mimer、H2、IBM Informix、SAP MAX DB、Cache、Ingres、Linter、...
MySQL、Oracle、PostgreSQL、IBM DB2、Microsoft SQL Server、clickhouse、Sybase、ODBC、Java DB (Derby)、Firebird (Interbase)、HSQLDB、SQLite、Mimer、H2、IBM Informix、SAP MAX DB、Cache、Ingres、Linter、...
1. **DriverManager**:用于加载驱动程序并建立数据库连接。 2. **Connection**:表示与数据库之间的连接。 3. **Statement**:用于发送SQL语句到数据库。 4. **ResultSet**:用于存储查询结果。 #### 二、JDBC驱动...
MySQL、Oracle、PostgreSQL、IBM DB2、Microsoft SQL Server、clickhouse、Sybase、ODBC、Java DB (Derby)、Firebird (Interbase)、HSQLDB、SQLite、Mimer、H2、IBM Informix、SAP MAX DB、Cache、Ingres、Linter、...
MySQL、Oracle、PostgreSQL、IBM DB2、Microsoft SQL Server、clickhouse、Sybase、ODBC、Java DB (Derby)、Firebird (Interbase)、HSQLDB、SQLite、Mimer、H2、IBM Informix、SAP MAX DB、Cache、Ingres、Linter、...
JDBC 驱动包合集 JAR包: Access cache db2 derby firebird hsqldb informix ingres jtds maxdb mssql mysql oracle postgresql sqlite
H2的兼容性非常强,支持多种数据库方言,包括与DB2、Apache Derby、HSQLDB、MSSQL Server、MySQL、Oracle以及PostgreSQL数据库的兼容性。它还具备了SQL注入问题的解决方案,使得应用更加安全。 H2数据库支持集群,...
数据库链接工具dbeaver-ce-7.0.0-x86_64-setup,兼容大部分数据库,使用简单,支持 MySQL, PostgreSQL, Oracle, DB2, MSSQL, Sybase, Mimer, HSQLDB, Derby, 以及其他兼容 JDBC 的数据库。 帮助你免除安装各种...
DBeaver 是一个通用的数据库管理工具和 SQL 客户端,支持 MySQL, PostgreSQL, Oracle, DB2, MSSQL, Sybase, GaussDB, HSQLDB, Derby, 以及其他兼容 JDBC 的数据库。