Working on developing a Restful web service for java-database-framework to easen up the process for backend development for java applications by handling jdbc and sql commands on its own through requests from the internet.
Just provide credentials, table and column identifiers and you are good to go . :)
The reason it/i am creating and parsing XMLs is to provide a two way approach to providing required parametrers, either you can call the functions with required parameters or you can edit the XMLs and provide the necesarry parameters there.
Will be working for mysql only, at least as of now . :(
mysql connector is required on build path for library as is a dependency of it. I do not own any rights for mysql connector, though it is available for free at : https://dev.mysql.com/downloads/connector/j/5.1.html
Mappings at 8080 are as follows :
1.) /init : First thing to do for creating a new table is to provide db credentials and these details will be picked up for every new table creation untill you change it, Accepts parameter as :
- a. connect : Connection string
- b. table : table name
- c. user : user name
- d. pass : password
2.) /create : Takes XML request body in format, db credentials defined here are not used but are requirede in XML :
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Create-Table>
<Connection-String String="jdbc:mysql://localhost:3306/mydb"/>
<Schema Name="service"/>
<username Name="root"/>
<Password Name="root"/>
<Column>
<Column-Name>col_11</Column-Name>
<Column-Data-Type>int</Column-Data-Type>
<Is-Primary-Key>Y</Is-Primary-Key>
<Default>2</Default>
</Column>
<Column>
<Column-Name>col_13</Column-Name>
<Column-Data-Type>int</Column-Data-Type>
<Is-Primary-Key>N</Is-Primary-Key>
<Default>NOT SET</Default>
</Column>
</Create-Table>
3.) /auto : AutoIncrements a particular column after checking all sql validations, accepts parameters as :
- column : column name
- seed : starting value for auto increment
- NOTE : TAKES TABLE NAME SET USING /init
4.) /credentials : If you have an already exisiting db structure and want to create beans for it use this, it accepts parameteres :
- (a) connection : Connection string
- (b) db : table name
- (c) user : user name
- (d) pass : password
almost same as /init but are kept in different file as that of /init so they are not used for table creation or setting auto increment . After setting this you have to use following mapping :
5.) /map : Used after /credentials to auto create beans.
6.) /getall : Retrieves all the data from a given table in JSON, parameter :
- a. table : table name
- a. table : table name
- b. column : column name
- c. condition : what column data should be equal to
- a. table : table name
9.) /dropcol : drops a column, accepts parameter :
- a. table : table name
- b.column : column name
- a. oldname : Current name of table
- b. newname : Name it should be set to
11.) /changecol : Changes a column name, accepts parameters as :
- a. table : table name
- b. oldname : Current name of column
- c. newname : Name it should be set to