List of usage examples for java.sql DriverManager getConnection
private static Connection getConnection(String url, java.util.Properties info, Class<?> caller) throws SQLException
From source file:CountRows_MySQL.java
public static Connection getConnection() throws Exception { String driver = "org.gjt.mm.mysql.Driver"; String url = "jdbc:mysql://localhost/octopus"; String username = "root"; String password = "root"; Class.forName(driver); // load MySQL driver Connection conn = DriverManager.getConnection(url, username, password); return conn;//from w w w .j av a 2 s.c om }
From source file:InsertTextFileToOracle.java
public static Connection getConnection() throws Exception { String driver = "oracle.jdbc.driver.OracleDriver"; String url = "jdbc:oracle:thin:@localhost:1521:oracle"; String username = "username"; String password = "password"; Class.forName(driver);//from ww w. j a va 2s.c om Connection conn = DriverManager.getConnection(url, username, password); return conn; }
From source file:CountRows_Oracle.java
public static Connection getConnection() throws Exception { String driver = "oracle.jdbc.driver.OracleDriver"; String url = "jdbc:oracle:thin:@localhost:1521:databaseName"; String username = "userName"; String password = "pass"; Class.forName(driver);// w w w . j a va 2 s . c o m Connection conn = DriverManager.getConnection(url, username, password); return conn; }
From source file:TestDebug_MySQL.java
public static Connection getConnection() throws Exception { String driver = "org.gjt.mm.mysql.Driver"; String url = "jdbc:mysql://localhost/octopus"; String username = "root"; String password = "root"; Class.forName(driver);//from w ww .java 2 s. c om return DriverManager.getConnection(url, username, password); }
From source file:DemoResultSetOracle.java
public static Connection getConnection() throws Exception { String driver = "oracle.jdbc.driver.OracleDriver"; String url = "jdbc:oracle:thin:@localhost:1521:databaseName"; String username = "username"; String password = "password"; Class.forName(driver); // load Oracle driver Connection conn = DriverManager.getConnection(url, username, password); return conn;//from ww w . j a v a 2 s . c om }
From source file:CheckJDBCInstallation_MySQL.java
public static Connection getConnection() throws Exception { String driver = "org.gjt.mm.mysql.Driver"; String url = "jdbc:mysql://localhost/databaseName"; String username = "root"; String password = "root"; Class.forName(driver); // load MySQL driver Connection conn = DriverManager.getConnection(url, username, password); return conn;/*from w ww . ja v a2 s . c o m*/ }
From source file:GetColumnNamesFromResultSet_MySQL.java
public static Connection getConnection() throws Exception { String driver = "org.gjt.mm.mysql.Driver"; String url = "jdbc:mysql://localhost/databaseName"; String username = "root"; String password = "root"; Class.forName(driver);/*from w w w . java 2 s . c om*/ Connection conn = DriverManager.getConnection(url, username, password); return conn; }
From source file:CheckJDBCInstallation_Oracle.java
public static Connection getConnection() throws Exception { String driver = "oracle.jdbc.driver.OracleDriver"; String url = "jdbc:oracle:thin:@localhost:1521:databaseName"; String username = "name"; String password = "pass"; Class.forName(driver); // load Oracle driver Connection conn = DriverManager.getConnection(url, username, password); return conn;//from w w w .j a v a2 s.co m }
From source file:GetColumnNamesFromResultSet_Oracle.java
public static Connection getConnection() throws Exception { String driver = "oracle.jdbc.driver.OracleDriver"; String url = "jdbc:oracle:thin:@localhost:1521:databaseName"; String username = "username"; String password = "pass"; Class.forName(driver);// w w w . j a v a 2 s .co m Connection conn = DriverManager.getConnection(url, username, password); return conn; }
From source file:Main.java
private static Connection getHSQLConnection() throws Exception { Class.forName("org.hsqldb.jdbcDriver"); String url = "jdbc:hsqldb:data/tutorial"; return DriverManager.getConnection(url, "sa", ""); }