Legal | Privacy
# connect.rb: Create connections to Oracle
require 'config.rb'

begin
	# login as normal user
	conn1 = OCI8.new(DB_USER, DB_PASSWORD, DB_SERVER)
	puts "login as normal user succeeded."
	conn1.logoff
	puts "logoff succeeded."	
	puts
	
	# login as DBA
	conn2 = OCI8.new('sys', 'oracle', DB_SERVER, :SYSDBA)
	puts "login with DBA privilege succeeded."
	conn2.logoff
	puts "logoff succeeded."

rescue OCIError
	# display the error message
	puts "OCIError occured!"
	puts "Code: " + $!.code.to_s
	puts "Desc: " + $!.message
end

puts '-'*80
E-mail this page
Printer View Printer View
Oracle Is The Information Company About Oracle | Oracle RSS Feeds | Careers | Contact Us | Site Maps | Legal Notices | Terms of Use | Privacy