Oracle Forms & PL/SQ  
 
  ROR  
 
  Java  
 
  php  
 
  ask us  
 

 

Contents



Oracle- Forms - PL/SQL

Database


Orders and Tables

PL/SQL



Oracle- Forms




Search a word:
   



© The scientific sentence. 2010

PL/SQL Java

PL/SQL & JDBC

1. PL/SQL and JDBC : SearchPhysicist.java:
Here is the related source code: 
//import the related packages import java.sql.*; import oracle.jdbc.pool.OracleDataSource; import oracle.jdbc.*; public class SearchPhysicist { public static void main (String args[]) throws SQLException { // We have to enter two arguments if ( args.length < 2) { System.out.println("Enter both a first and last name as command-line arguments."); System.out.println("You can enter a complete name or an initial substring."); System.out.println("For example: java SearchPhysicist m Di "); } else { // connect to a local XE database OracleDataSource ods = new OracleDataSource(); //ods.setURL("jdbc:oracle:thin:user-name/password@host:1521/XE"); ods.setURL("jdbc:oracle:thin:System/password@machine-name:1521/XE"); //ods.setURL("jdbc:oracle:thin@machine-name:1521:XE","System","password"); Connection conn = ods.getConnection(); String physquery = "begin get_phys_info(?, ?, ?); end;"; CallableStatement callStmt = conn.prepareCall(physquery); callStmt.registerOutParameter(3, OracleTypes.CURSOR); callStmt.setString(1, args[0]); callStmt.setString(2, args[1]); callStmt.execute(); // return the result set ResultSet rset = (ResultSet)callStmt.getObject(3); // Get the number of columns ifor each row ResultSetMetaData rsetMeta = rset.getMetaData(); int count = rsetMeta.getColumnCount(); // For each rsult found, print it in a row while (rset.next()) { String rsetRow = ""; for (int i=1; i<=count; i++){ rsetRow = rsetRow + " " + rset.getString(i); } System.out.println(rsetRow); } } } } 2. PL-SQL with JDBC: The result: C:\J2EE\PL-SQL>javac SearchPhysicist.java Search for a physicist: C:\J2EE\PL-SQL>java SearchPhysicist l d 106 Louis DeBroglie 1892 1987 wave_mechanics C:\J2EE\PL-SQL>java SearchPhysicist j th 101 Joseph Thomson 1856 1940 atomic C:\J2EE\PL-SQL>java SearchPhysicist m Di 108 Maurice Dirac 1902 1984 atomic C:\J2EE\PL-SQL> Compile as:
  
Google
Web
ScientificSentence
 




chimie labs
|
scientific sentence
|
java
|
php
|
green cat
|
contact
|


© Scientificsentence 2009. All rights reserved.