Problem to Dynamic Connect to postgreSQL

This is a discussion on Problem to Dynamic Connect to postgreSQL within the Beginning Developers forums, part of the Android Development category; Hi everyone. I'm newbie in android. I've dynamic connected completely to postgreSQL in code below: Code: EditText Address, Port, Database, User, Pass; Connection connection = ...

Results 1 to 4 of 4

Thread: Problem to Dynamic Connect to postgreSQL

  1. #1
    Android Lurker whiteboy's Avatar
    Join Date
    May 2012
    Posts
    1

    Problem to Dynamic Connect to postgreSQL

    Hi everyone. I'm newbie in android. I've dynamic connected completely to postgreSQL in code below:
    Code:
    EditText Address, Port, Database, User, Pass;
        Connection connection = null;
        
        public boolean get_connection(){    
            
            String address, port, database, user, pass;
            address = Address.getText().toString();
            port = Port.getText().toString();
            Database = Database.getText().toString();
            user = User.getText().toString();
            pass = Pass.getText().toString();
            
            try {
                Class.forName("org.postgresql.Driver");
            } catch (ClassNotFoundException e) {
                e.printStackTrace();
                return false;
            }
            
            
            
               String url = "jdbc:postgresql://" + address + ":" + port + "/" + database;
    
               try {
                   connection = DriverManager.getConnection(url, user, pass);
                
                } catch (java.sql.SQLException e) {
                    e.printStackTrace();
                       return false;
                }
                return true;
        }
    I don't know how to hold that connection information to use for many others activities-java class(EX: for each time one Activity want to connect to load data can use that connection information). Thank in advance.

  2. Android.net is the premier Android Forum. Registered users do not see these ads. .

  3. #2
    Super Moderator UltraDroid's Avatar
    Join Date
    Jan 2011
    Location
    Cleveland, Ohio - the North Coast, Baby!
    Posts
    7,570
    Thanked
    519 times
    Hello whiteboy, and welcome to the forum!
    GSM Galaxy Note 3 (Black) - Straight Stock
    GSM Galaxy Note 2 (Titanium) - Rooted running Jedi X20 Rom
    GSM Galaxy Nexus (Black) - Straight Stock

    GSM Samsung Galaxy S3 (Red) - Rooted running Deadly Venom v8.0.1 Rom


  4. #3
    Super Moderator cali's Avatar
    Join Date
    Sep 2011
    Posts
    4,830
    Thanked
    329 times
    Can't help you with the task at hand, but can welcome you to the site!

  5. #4
    Android Lurker ebookren's Avatar
    Join Date
    Aug 2012
    Posts
    2
    I notice you use the same String names, one uppercase one lower. Your Database= Database Should be database=Database.getText().toString()

    Chris

    Sent from my Nexus 7 using Android.net
    Last edited by ebookren; 08-30-2012 at 08:48 AM.

Remove Ads

http://www.scramblerducati.org/

Sponsored Links

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Similar Threads

  1. how to connect?????
    By rachitdon in forum Samsung Galaxy S2
    Replies: 4
    Last Post: 09-27-2011, 11:35 PM
  2. Wi-Fi won't connect
    By JaneInVegas in forum Motorola i1 Tech Support
    Replies: 0
    Last Post: 07-23-2011, 02:07 AM
  3. connect with pc
    By zsuzsanna19 in forum LG Ally Help
    Replies: 17
    Last Post: 07-05-2011, 05:52 PM
  4. Dynamic (configurable) endpoint address
    By ampo in forum LG Ally Help
    Replies: 0
    Last Post: 02-27-2011, 03:57 AM

Search tags for this page

android class.forname(org.postgresql.driver)
,

android connect to postgresql

,

android postgres connection

,
android postgresql
,
android psql
,

connect android postgresql

,
connect android to postgresql
,

connect postgres on android

,
connect to postgres database android
,
connectio pgsql android
,

how to connect android to postgresql

,
postgres on android
,
postgresql on android problems
,
postgresql to android connection
,
use postgres in android
Click on a term to search our sites for related topics.
Android Forum