⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hsqldbconnection.java

📁 Spring framework basic tutorial using Java
💻 JAVA
字号:
package tutorial.model;

import java.sql.Connection;

import org.hsqldb.jdbc.jdbcDataSource;

public class HSQLDBConnection implements DBConnection {

	@Override
	public Connection getConnection() {
		// Exceptions may occur
		try {

			// get a DataSource object and set the URL
			// 'testfiles' in the URL is the name of the database
			jdbcDataSource dataSource = new jdbcDataSource();

			dataSource.setDatabase("jdbc:hsqldb:file:testfiles");

			// Connect to the database
			// It will be create automatically if it does not yet exist
			// "sa" is the user name and "" is the (empty) password
			Connection conn = dataSource.getConnection("SA", "");			
			return conn;
		} catch (Exception e) {

			// Print out the error message
			System.out.println(e);
			e.printStackTrace();
		}
		return null;

	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -