?? jdbc.java
字號:
/*
* Created on 2004-9-23
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package Conn;
import java.io.*;
import java.sql.*;
/**
* @author administrator
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class jdbc {
public jdbc()
{
}
static Connection conn = null;
public static java.sql.Connection getConn()
{
try
{
//加載數據庫驅動
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
//創建數據庫URL對象,建立連接
conn = DriverManager.getConnection("jdbc:odbc:DataSource","uid","pws");
}
catch(Exception e)
{
e.printStackTrace();
System.out.println("abcdef");
}
return conn;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -