Giter VIP home page Giter VIP logo

cloudxtreme / accessremotemysqldb Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 8 KB

This API serves you the facility of accessing remote MySQL database located at any server in very simplest manner. The main point of attraction of this API is that it doesn't use any driver of jdbc:mysql, so there is no need of importing MySQL JDBC Driver. If you are new at java programming and have not much experience of JDBC then go for it, it will surely help you.

PHP 100.00%

accessremotemysqldb's Introduction

#How to use AccessRemoteMySQLDB?

  1. Copy file 'handleSQL.php' to the remote server where your database is located (remember to note down the url of the 'handleSQL.php'. url ex: example.com/somedirectory/handleSQL.php)
  2. Add AccessRemoteMySQLDB.jar to your project
  3. import required classes and that's all :)

for any query write me at [email protected]

example program:

file name: Example.java

import armdb.*;

public class Example {

public static void main(String[] args) {

      String fileURL="http://example.com/some_directory/handleSQL.php";	//url of 'habdleSQL.php', remember that the 'habdleSQL.php' must be in the same server in which interested database is located
    String host="mysql.some_hosting.com";					//server host name
    String user="some_user";						//username
    String pass="some_password";						//password
    String DBName="some_dbname";						//database name
    
ConnectHost con=new ConnectHost(fileURL, host, user, pass, DBName);	//make connection



//make a query and print the set of retrieved data

SQLQuery query=new SQLQuery(con);     					
try{
        QueryResult qr=query.statement("select * from table_name");		//execution of query statement
        while(qr.nextFlag()){						//setting flag to next row till next row exists
            System.out.println(qr.getValue("column_1")+", ");		//printing column_1 data of the row where flag is set
            System.out.print(qr.getValue("column_2")+", ");			//printing column_2 data of the row where flag is set
            System.out.print(qr.getValue("column_3")+", ");			//printing column_3 data of the row where flag is set
            System.out.print(qr.getValue("column_4"));			//printing column_4 data of the row where flag is set
        }
    }catch(SQLQueryException e){						//catch exception if occurred
        System.out.println(e.getMessage());					//print exception message 
    }



//execute an update statement and print the number of rows affected	

SQLUpdate update=new SQLUpdate(con);					
    try{
        int rows=update.statement("insert into table_name values ('value_1','value_2','value_3','value_4')");	//execution of update statement
        System.out.println(rows+" no. of rows affected");								//printing no. of affected rows
    }catch(SQLUpdateException e){											//catch exception if occurred
        System.out.println(e.getMessage());										//print exception message
    }
}

}

accessremotemysqldb's People

Contributors

rohit7209 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.