Check Statement Pooling

From Java Example Source Code

Jump to: navigation, search

Contents

[edit] Overview - Check Statement Pooling

This Java example program shows how to check statement pooling.

[edit] Java Source Code

  • Package: example.jdbc.metadatadbinfo
  • File: CheckStatementPooling.java
package example.jdbc.metadatadbinfo;
 
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
 
public class CheckStatementPooling {
 
    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 = "password";
	Class.forName(driver); // load Oracle driver
	Connection conn = DriverManager.getConnection(url, username, password);
	return conn;
    }
 
    public static void main(String[] args) throws Exception {
	Connection conn = getConnection();
	try {
	    DatabaseMetaData dbmd = conn.getMetaData();
	    if (dbmd == null) {
		System.out.println("No");
	    }
	    if (dbmd.supportsStatementPooling()) {
		System.out.println("statement pooling is supported");
	    } else {
		System.out.println("No");
	    }
	} catch (Exception e) {
	    e.printStackTrace();
	} finally {
	    conn.close();
	}
    }
}

[edit] What Result You Can Get

Coming soon... Run the program, you will get:

Replace with the result of you Java program.

[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: In order to run this example program, 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