Go Back   Android Forums > Android Development > Application Development
Application Development Dev lounge for our application developers.

Get excited for the Samsung Galaxy S5! Find everything you need and discuss it in our Galaxy S5 Forum!

test: Reply
 
LinkBack Thread Tools
Old April 10th, 2011, 07:19 PM   #1 (permalink)
New Member
Thread Author (OP)
 
Join Date: Apr 2011
Posts: 1
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 0 Times in 0 Posts
Default Oracle database connection using jbdc

Hi all
I am trying to communicate with an oracle database using jbdc, I need to read and write to the database, I dont have server access so have to commincate directly with the database. At the moment I am struggling to even get a connection. The app only needs to be simulated on a secure network so I am not too worried about security issues.
code im using:
Code:
package com.tentantrepairs;

import java.sql.Connection;
import java.sql.DriverManager;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class TenantRepairs extends Activity{
	@Override
	public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	TextView tv = new TextView(this);
	tv.setText("orcale Connect Example.");
	setContentView(tv);
	
	Connection conn;
	String url = "jdbc:oracle:thin:@blah.blah.blah.ac.uk:1522:orcl";
	String userName = "PRCSF"; 
	String password = "PRCSF";
	try {
		Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
	  conn = DriverManager.getConnection(url,userName,password);
	  tv.setText("Connected to the database");
	} catch (Exception e) {
		tv.setText("nope");
	}
	}
	}
Many thanks Ben

mogly is offline  
Reply With Quote
sponsored links
Reply


Go Back   Android Forums > Android Development > Application Development
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 03:24 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.