0% found this document useful (0 votes)
48 views

Oracle Netbeans Connectivity

This document discusses connecting to an Oracle database from Java code using NetBeans and querying a table. It loads the Oracle driver, establishes a connection to a database on localhost, creates a Statement object, executes a SQL query on the employee table to select the first name and SSN where the last name is "tank", and prints out the results.

Uploaded by

prasath_676303
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views

Oracle Netbeans Connectivity

This document discusses connecting to an Oracle database from Java code using NetBeans and querying a table. It loads the Oracle driver, establishes a connection to a database on localhost, creates a Statement object, executes a SQL query on the employee table to select the first name and SSN where the last name is "tank", and prints out the results.

Uploaded by

prasath_676303
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

http://stackoverflow.com/questions/9816412/oracle-11g-connectivity-with-javain-netbeans-7-1 Class.forName("oracle.jdbc.OracleDriver"); System.out.println("DRIVER LOADED!"); Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE", "system", "acpsa") ; System.out.println("CONNECTION ESTABLISHED!

");

Now I want to access a table employee(fname,lname,ssn), retrieving all records and displaying them.

Statement stmt; stmt=(Statement)conn.createStatement(); String qq = "select fname,ssn from employee where lname='tank'"; ResultSet rs = (ResultSet)stmt.executeQuery(qq); while(rs.next()){ System.out.println(rs.getString("fname") + "\t" + rs.getString("ssn")); }

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy