A Test of the Thin Driver for an Application

From Java Example Source Code

Jump to: navigation, search

Contents

[edit] Overview - A Test of the Thin Driver for an Application

This Java example program demonstrates how to use thin driver for Oracle.

[edit] Java Source Code

  • Package: balse.donald
  • File: TestThinApp.java
package balse.donald;
 
// Java Programming with Oracle JDBC
// By Donald Bales
// Published by O'Reilly, 2001
// ISBN 059600088X, 9780596000882
 
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
 
public class TestThinApp {
 
    public static void main(String args[]) throws ClassNotFoundException, SQLException {
 
	Class.forName("oracle.jdbc.driver.OracleDriver");
	// DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
 
	Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@dssw2k01:1521:orcl", "scott", "tiger");
 
	Statement stmt = conn.createStatement();
	ResultSet rset = stmt.executeQuery("select 'Hello Thin driver tester '||USER||'!' result from dual");
	while (rset.next())
	    System.out.println(rset.getString(1));
	rset.close();
	stmt.close();
	conn.close();
    }
}

[edit] What Result You Can Get

Coming soon...

[edit] Required External Libraries and/or Files for this Java Example

In order to run this Java example, one of the following libraries may be required:


[edit] How to Run this Java Example Program

We recommend running this Java example program with Eclipse.

For assistance in working with Eclipse, please see How to Run Java Program with Eclipse.

It's fairly easy.



[edit] Question & Answer

Any question?

Click edit and post your question or answer here.


Personal tools