Android Tutorial Remote Database Connector (RDC) - Connect to any remote DB

Status
Not open for further replies.
jRDC version 2 is available here: https://www.b4x.com/android/forum/t...ation-of-rdc-remote-database-connector.61801/

This tutorial covers a new framework named Remote Database Connector (RDC). The purpose of RDC is to make it simple to develop Android applications that interact with remote database servers.

There are two components in this framework: a lightweight Java web server (the middleware) and a B4A class named DBRequestManager that interacts with this web server.

The Java web server can connect to any database platform that provides a JDBC driver.

This includes: MySQL, SQL Server, Oracle, Sybase, DB2, postgreSQL, Firebird and many others.

You can also use the web server without a database server by connecting to a local SQLite database file.

The Java web-server is a simple server that connects to the database server and to the Android clients.
As this is a Java app you can run it on Linux or Windows computers. It requires Java JRE 6 or 7.

This solution is much more powerful than the PHP (MySQL) and ASP.Net (MS SQL) solutions that are already available.

Main advantages over previous solutions:
  • Support for many types of database platforms.
  • Significantly better performance.
  • SQL statements are configured in the server (safer).
  • Support for all types of statements, including batch statements.
  • Support for BLOBs.

Server Configuration

JDBC is a Java API that provides a standard method to access any database. A database driver (jar file) is required for each type of database. You will need to download the driver for your database and put it in the jdbc_driver folder.

The Java server configuration is saved in a file named config.properties.
This file includes two sections: general configuration and a list of SQL commands.

For example:

SS-2013-08-04_16.10.20.png


Note that the configuration fields are case sensitive.

DriverClass / JdbcUrl - The values of these two fields are specific to each database platform. You will usually find the specification together with the required driver jar file.

User / Password - Database user and password.

ServerPort - The Java server will listen to this provided port.

Debug - If Debug is set to true then the SQL commands list will be loaded on every request. This is useful during development as it allows you to modify the commands without restarting the server process.

SQL Commands - A list of commands. Each command starts with 'sql.'. The commands can include question marks (parameterised queries). Question marks will be replaced with the values provided by the Android clients. Note that the command name is case sensitive and it doesn't include the 'sql.' prefix.

Client Code
The client sends requests to the server. There are two types of requests: query requests (usually SELECT statements) and batch requests (any other statement).

Note that both the client and the server can manage multiple requests in parallel.
Usually you will only need a single DBRequestManager object.

Each request is made of a command (or a list of commands) and a tag. The tag can be any object you like. You can use it later when the result is ready. The tag is not sent to the server.

A command is an object of type DBCommand:
B4X:
Type DBCommand (Name As String, Parameters() As Object)
Name - The case sensitive command name as configured in the server configuration (without sql.).
Parameters - An array of objects that will be sent to the server and will replace the question marks in the command.

For example to send a SELECT request:
B4X:
Dim cmd As DBCommand
cmd.Initialize
cmd.Name = "select_animal"
cmd.Parameters = Array As Object("cat 1")
reqManager.ExecuteQuery(cmd, 0, "cat 1")
ExecuteQuery expects three parameters: the command, maximum number of rows to return or 0 if there is no limit and the tag value.

Under the hood DBRequestManager creates a HttpJob for each request. The job name is always "DBRequest".

You should handle the JobDone event in your activity or service:
B4X:
Sub JobDone(Job As HttpJob)
   If Job.Success = False Then
     Log("Error: " & Job.ErrorMessage)
   Else
     If Job.JobName = "DBRequest" Then
       Dim result As DBResult = reqManager.HandleJob(Job)
       If result.Tag = "cat 1" Then 'query tag
         For Each records() As Object In result.Rows
           Dim name As String = records(0) 'or records(result.Columns.Get("name"))
           Log(name)
         Next
       End If
     End If
   End If
   Job.Release
End Sub

As you can see in the above code, DBRequestManager.HandleJob method takes the Job and returns a DBResult object:
B4X:
Type DBResult (Tag As Object, Columns As Map, Rows As List)
Tag - The request tag.
Columns - A Map with the columns names as keys and the columns ordinals as values.
Rows - A list that holds an array of objects for each row in the result set.

Non-select commands are sent with ExecuteCommand (single command) or ExecuteBatch (any number of commands). It is significantly faster to send one request with multiple commands over multiple requests. Batch statements are executed in a single transaction. If one of the commands fail all the batch commands will be cancelled (roll-backed).

Note that for non-select requests, Rows field in the results will hold an array with a single int for each command. The int value is the number of affected rows (for each command separately).

Initializing DBRequestManager:
B4X:
Sub Activity_Create(FirstTime As Boolean)
   If FirstTime Then
     reqManager.Initialize(Me, "http://192.168.0.100:17178")
   End If
End Sub
The first parameter is the module that will handle the JobDone event.
The second parameter is the link to the Java server (with the port number).

DBRequestManager provides the following helper methods for common tasks related to BLOB fields: FileToBytes, ImageToBytes and BytesToImage.It also includes a method named PrintTable that prints DBTable objects to the logs.

Framework Setup
  1. Unpack the server zip file.
  2. You will need to download the driver for your database platform and copy the jar file to jdbc_driver folder.
  3. Edit config.properties as discussed above.
  4. Edit RunRLC.bat and set the path to java.exe. If you are running it on Linux then you need to create a similar script with the path to java. On Linux you should change the ';' separator to ':'.
  5. Run the server :)
    You should see something like:

    SS-2013-08-04_17.05.16.png


    Note that the path to config.properties is printed in the second line.
  6. Add an exception for the server port in your firewall.
  7. Try to access the server from the browser:

    SS-2013-08-04_17.06.17.png


    You will probably not see the above message on the first run :(. Instead you will need to check the server output and read the error message.
    If you are able to call the server from the local computer and not from other devices then it is a firewall issue.

Tips

  • MySQL driver is available here: http://dev.mysql.com/downloads/connector/j/
  • Google for <your database> JDBC Driver to find the required driver. For SQL Server you can use this open source project: http://jtds.sourceforge.net/
  • The server uses an open source project named c3p0 to manage the database connection pool. It can be configured if needed by modifying the c3p0.properties file.
  • Use a text editor such as Notepad++ to edit the properties file.
  • If you are running the server on Linux then you can run it with nohup to prevent the OS from killing the process when you log out.
  • Java doesn't need to be installed. You can just unpack the files.
The server is based on the two following open source projects:
Jetty - http://www.eclipse.org/jetty/
c3p0 - http://www.mchange.com/projects/c3p0/index.html
http://www.mchange.com/projects/c3p0/index.html
 
Last edited:

Stormer

New Member
You should use HttpUtils2 v2.01+. It was included in B4A v2.71. If you are using a previous version of B4A then you can download the source here: http://www.b4x.com/android/forum/th...vices-are-now-even-simpler.18992/#post-109068
Use the two modules instead of the library.


Binary format. You can see how it is implemented in the DBRequestManager class.


See the explanation of the Debug property in the tutorial.

Is there any way/tutorial how can I check the connection not to local database but to remote mysql database? For example, I have remote database
with
Host: myremotedb.com
User: my_user
Database Password: my_password
Port number: 3306

How need I change config-files or something else and what should I type in the address field of my browser to check that all is working correctly.
Please, help! Need it so much.
 

keirS

Well-Known Member
Licensed User
Longtime User
Is it possible to use the JDBC-ODBC bridge driver ("sun.jdbc.odbc.JdbcOdbcDriver") with RDC? The thing which is confusing me is that you say to copy the JDBC driver into the driver directory. The bridge diver is included in the Java Windows run time (RT.jar) and is already in the classpath.
 

persianpowerman1

Active Member
Licensed User
Longtime User
Can some one guide me... im stuck on the last step... checking the server from the browser...

RemoteServer is running (Sat Dec 07 21:25:25 IST 2013)
java.sql.SQLException: An attempt by a client to checkout a Connection has timed out.

and when i run the "animal" example.. i get this error...
Error: org.apache.http.conn.HttpHostConnectException: Connection to http://127.0.0.1:17178 refused

what is happening?? can someone please help me???
 

keirS

Well-Known Member
Licensed User
Longtime User
It should work. Note that Oracle do not recommend it for production use: http://docs.oracle.com/javase/1.5.0/docs/guide/jdbc/getstart/bridge.doc.html

You do not need to any any jar.

Thanks Erel . Got it working with a system DSN. A connection string doesn't work:

{Microsoft Visual FoxPro Driver};Collate=Machine; BackgroundFetch=Yes; Exclusive=No; SourceType=DBC; SourceDB=C:\testdb\data\projects.dbc

The RDC strips out the backslash characters for the SourceDB. None of the JDBC drivers for Visual Fox support stored procedures; triggers etc.
 

Gabino A. de la Gala

Active Member
Licensed User
Longtime User
¿Are there any way to know the type of fields obtained in the select querys?

I'd like to create a local database in runtime to store data locally. This database will be deteled/created each time to prevent posibles changes in the server part.

Is this posible?

In Spanish:

El obtener los datos y almacenarlos localmente ya lo tengo más/menos operativo, lo que estoy intentando conseguir ahora es que la creación de la tabla local no sea fija por programa, sino que se haga dinámicamente en función de los datos obtenidos del servidor, para así evitar tener que andar enviando actualizaciones del programa cada vez que retoque algo en las vistas y también me daría la posibilidad de crear una especie de librería para obtener datos y almacenarlos localmente.

Un saludo.
 

Gabino A. de la Gala

Active Member
Licensed User
Longtime User
Yes it is possible. The syntax finding the column data type is vendor specific. Why do you need it?

Don't you know the structure of the server database?
I'd like to do sometido universal.

I would like to prepare a method passing the name of the view (previously prepared in the server database) generate a local copy of that data.

This local copy would be created each time based on data from the view (this view may be modified at the server side without having to go to update the program of android devices)

The back shows the data in the android device will also "open" in the sense that the user could select the fields to display, sort that column, etc..
 

dibesw

Active Member
Licensed User
Longtime User
Hi,
I'm using very good jackaccess lib.
Is it possible manage the same mdb database with Remote Database Connector (RDC)?
If yes, where I can download correct JDBC driver (mdb/accdb database)?
Thanks
 
Last edited:

georgelbs

Member
Licensed User
Longtime User
I have the following code: (Database Oracle 11G):

Sub Sincroniza_Direcciones
Dim CUR As Cursor
Dim cmd, cmd1, cmd2, cmd3 As DBCommand
Dim consulta As String
Dim CLI_ID As Int
consulta="SELECT DISTINCT(CLI_ID) CLI_ID FROM mov_clientes ORDER BY CLI_ID"
CUR= SQL.ExecQuery(consulta)
If CUR.IsInitialized Then
DBUtils.DeleteAllRecord(SQL, "mov_direcciones")
DBUtils.DeleteAllRecord(SQL, "mov_telefonos")
DBUtils.DeleteAllRecord(SQL, "mov_referencias")
DBUtils.DeleteAllRecord(SQL, "mov_ult_gestiones")
cmd.Initialize
cmd1.Initialize
cmd2.Initialize
cmd3.Initialize
If CUR.RowCount> 0 Then
For i=0 To CUR.RowCount -1
CUR.Position = i
CLI_ID=CUR.GetInt("CLI_ID")
cmd.Name = "select_direcciones"
cmd.Parameters = Array As Object(CLI_ID)
reqManager.ExecuteQuery(cmd,0, "direcciones")
cmd1.Name = "select_telefonos"
cmd1.Parameters = Array As Object(CLI_ID)
reqManager.ExecuteQuery(cmd1,0, "telefonos")
' cmd2.Name = "select_referencias"
' cmd2.Parameters = Array As Object(CLI_ID)
' reqManager.ExecuteQuery(cmd2,0, "referencias")
' cmd3.Name = "select_ult_gestiones"
' cmd3.Parameters = Array As Object(CLI_ID)
' reqManager.ExecuteQuery(cmd3,0, "ultimas_gestiones")
Next
ProgressDialogHide
End If
CUR.Close
End If
End Sub

The code works but if I uncomment and try with 3 or more (reqManager.ExecuteQuery(cmdx,0, "xxxx") simply nothing happen, even the firsts 2 request aren´t executed. I tried combine the request1 with request3 commenting the 2 and so on, and works, but more than 2 requests simply don´t works.

Please put me on the right direction about this issue
 

georgelbs

Member
Licensed User
Longtime User
Please use [ code ] [ /code ] tags (without spaces) when posting code.

Where is the JobDone code? Do you get any error in the server logs?

Which server are you using?


None error in server logs, the server is Oracle 11G, I´m using the most update version of RDC server and client, the jobdone code is:

[ code ]
JobDone (job As httpjob)
Dim SQLtext As String
Dim req As HttpRequest
Dim cant, i As Int
Dim rs As Cursor
Dim filas1, ListaClientes, ListaActividades As List
'Dim ListaDirecciones, ListaTelefonos, ListaReferencias, ListaUltimasGestiones As List
Dim columnas As Map
If job.Success = False Then
Log("Error: " & job.ErrorMessage)
ToastMessageShow("Error en la conexión",False)
ProgressDialogHide
Else
If job.JobName = "DBRequest" Then
Dim result As DBResult = reqManager.HandleJob(job)
Dim datos() As String
Dim i As Int
Dim l As List
l.Initialize
i=0
filas1.Initialize
filas1 = result.Rows
columnas.Initialize
columnas=result.Columns
If filas1.IsInitialized Then
If filas1.Size <= 0 Then Return
End If
If columnas.IsInitialized Then
If columnas.Size <= 0 Then Return
End If
For Each row() As Object In result.Rows
For Each record As Object In row
l.add(record)
i=i+1
Next
Next
If job.Tag ="clientes" Then
' ToastMessageShow("Actualizando Clientes desde el servidor...", False)
ListaClientes.Initialize
ListaClientes.Clear
i=0
For Each row() As Object In result.Rows
Dim mClientes As Map
mClientes.Initialize
mClientes.Clear
mClientes.Put("AGE_ID",row(0))
mClientes.Put("AGE_AGENTE", row(1))
mClientes.Put("PLA_FECHA",row(2))
mClientes.Put("PLA_ID",row(3))
mClientes.Put("PLA_OBSERVACION", row(4))
mClientes.Put("GCO_ID",row(5))
mClientes.Put("ZON_ID",row(6))
mClientes.Put("ZON_ZONA", row(7))
mClientes.Put("CLI_ID",row(8))
mClientes.Put("CLI_NOMBRE",row(9))
mClientes.Put("CXC_ID", row(10))
mClientes.Put("CLO_NRO_VENCIMIENTO",row(11))
mClientes.Put("CLO_FECHA_VENCIMIENTO",row(12))
mClientes.Put("CLO_VALOR_CUOTA", row(13))
mClientes.Put("CLO_SALDO_CUOTA",row(14))
mClientes.Put("CLO_INT_MORA_GENERADO",row(15))
mClientes.Put("CLO_GTO_COB_GENERADO", row(16))
mClientes.Put("ITE_SKU_ID",row(17))
mClientes.Put("ITE_DESC_LARGA",row(18))
ListaClientes.Add(mClientes)
Next
DBUtils.InsertMaps(SQL, "mov_clientes", ListaClientes)
Sincroniza_Direcciones_Telefonos
End If
If job.Tag ="me" Then
If result.Rows.Size > 0 Then
Sincroniza_Oracle
Else
ToastMessageShow("No se puede conectar a la base de datos de Marcimex", False)
End If
End If
If job.Tag ="me1" Then
If result.Rows.Size > 0 Then
GetDatosCliente(Utils.CodigoVendedor)
Else
ToastMessageShow("No se puede conectar a la base de datos de Marcimex", False)
End If
End If
If job.Tag ="ACTIVIDADES" Then
Sincroniza_Verificaciones
End If
If job.Tag ="VERIFICACIONES" Then
ToastMessageShow("sincronizando clientes",False)
GetDatosCliente(Utils.CodigoVendedor)
End If
If job.Tag ="direcciones" Then
ListaDirecciones.Initialize
ListaDirecciones.Clear
For Each row() As Object In result.Rows
Dim mDirecciones As Map
mDirecciones.Initialize
mDirecciones.Clear
mDirecciones.Put("DIR_ID",row(0))
mDirecciones.Put("CLI_ID", row(1))
mDirecciones.Put("DIR_TIPO",row(2))
mDirecciones.Put("DIR_DESCRIPCION", row(3))
mDirecciones.Put("DIR_REF_UBICACION",row(4))
ListaDirecciones.Add(mDirecciones)
Next
DBUtils.InsertMaps(SQL, "mov_direcciones", ListaDirecciones)
End If
If job.Tag ="telefonos" Then
ListaTelefonos.Initialize
ListaTelefonos.Clear
For Each row() As Object In result.Rows
Dim mTelefonos As Map
mTelefonos.Initialize
mTelefonos.Clear
mTelefonos.Put("TEL_ID",row(0))
mTelefonos.Put("CLI_ID", row(1))
mTelefonos.Put("TEL_TIPO",row(2))
mTelefonos.Put("TEL_NUMERO", row(3))
ListaTelefonos.Add(mTelefonos)
Next
DBUtils.InsertMaps(SQL, "mov_telefonos", ListaTelefonos)
End If
If job.Tag ="referencias" Then
ListaReferencias.Initialize
ListaReferencias.Clear
For Each row() As Object In result.Rows
Dim mReferencias As Map
mReferencias.Initialize
mReferencias.Clear
mReferencias.Put("REF_ID",row(0))
mReferencias.Put("CLI_ID", row(1))
mReferencias.Put("RCL_TIPO",row(2))
mReferencias.Put("RCL_PRI_NOM", row(3))
mReferencias.Put("RCL_PRI_APE", row(4))
mReferencias.Put("RCL_TIP_TEL", row(5))
mReferencias.Put("RCL_TEL_NUM", row(6))
ListaReferencias.Add(mReferencias)
Next
DBUtils.InsertMaps(SQL, "mov_referencias", ListaReferencias)
End If
If job.Tag ="ultimas_gestiones" Then
ListaUltimasGestiones.Initialize
ListaUltimasGestiones.Clear
For Each row() As Object In result.Rows
Dim mUltimasGestiones As Map
mUltimasGestiones.Initialize
mUltimasGestiones.Clear
mUltimasGestiones.Put("ULG_ID",row(0))
mUltimasGestiones.Put("ULG_DESCIPCION",row(1))
mUltimasGestiones.Put("ULG_FECHA_GESTION", row(2))
mUltimasGestiones.Put("CLI_ID", row(3))
ListaUltimasGestiones.Add(mUltimasGestiones)
Next
DBUtils.InsertMaps(SQL, "mov_ult_gestiones", ListaUltimasGestiones)
ProgressDialogHide
End If
End If
End If
job.Release
End Sub
[ /code ]
 

Erel

B4X founder
Staff member
Licensed User
Longtime User

aklisiewicz

Active Member
Licensed User
Longtime User
Im getting errors on test, but I think it is because the configuration file expects SQL (not SQLite).
can you please post an example of configuration file for SQLite.

Arthur



This tutorial covers a new framework named Remote Database Connector (RDC). The purpose of RDC is to make it simple to develop Android applications that interact with remote database servers.




Server Configuration

JDBC is a Java API that provides a standard method to access any database. A database driver (jar file) is required for each type of database. You will need to download the driver for your database and put it in the jdbc_driver folder.

The Java server configuration is saved in a file named config.properties.
This file includes two sections: general configuration and a list of SQL commands.

For example:

SS-2013-08-04_16.10.20.png


Note that the configuration fields are case sensitive.

DriverClass / JdbcUrl - The values of these two fields are specific to each database platform. You will usually find the specification together with the required driver jar file.

User / Password - Database user and password.

ServerPort - The Java server will listen to this provided port.

Debug - If Debug is set to true then the SQL commands list will be loaded on every request. This is useful during development as it allows you to modify the commands without restarting the server process.

SQL Commands - A list of commands. Each command starts with 'sql.'. The commands can include question marks (parameterised queries). Question marks will be replaced with the values provided by the Android clients. Note that the command name is case sensitive and it doesn't include the 'sql.' prefix.

Client Code
The client sends requests to the server. There are two types of requests: query requests (usually SELECT statements) and batch requests (any other statement).

Note that both the client and the server can manage multiple requests in parallel.
Usually you will only need a single DBRequestManager object.

Each request is made of a command (or a list of commands) and a tag. The tag can be any object you like. You can use it later when the result is ready. The tag is not sent to the server.

A command is an object of type DBCommand:
B4X:
Type DBCommand (Name As String, Parameters() As Object)
Name - The case sensitive command name as configured in the server configuration (without sql.).
Parameters - An array of objects that will be sent to the server and will replace the question marks in the command.

For example to send a SELECT request:
B4X:
Dim cmd As DBCommand
cmd.Initialize
cmd.Name = "select_animal"
cmd.Parameters = Array As Object("cat 1")
reqManager.ExecuteQuery(cmd, 0, "cat 1")
ExecuteQuery expects three parameters: the command, maximum number of rows to return or 0 if there is no limit and the tag value.

Under the hood DBRequestManager creates a HttpJob for each request. The job name is always "DBRequest".

You should handle the JobDone event in your activity or service:
B4X:
Sub JobDone(Job As HttpJob)
   If Job.Success = False Then
     Log("Error: " & Job.ErrorMessage)
   Else
     If Job.JobName = "DBRequest" Then
       Dim result As DBResult = reqManager.HandleJob(Job)
       If result.Tag = "cat 1" Then 'query tag
         For Each records() As Object In result.Rows
           Dim name As String = records(0) 'or records(result.Columns.Get("name"))
           Log(name)
         Next
       End If
     End If
   End If
   Job.Release
End Sub

As you can see in the above code, DBRequestManager.HandleJob method takes the Job and returns a DBResult object:
B4X:
Type DBResult (Tag As Object, Columns As Map, Rows As List)
Tag - The request tag.
Columns - A Map with the columns names as keys and the columns ordinals as values.
Rows - A list that holds an array of objects for each row in the result set.

Non-select commands are sent with ExecuteCommand (single command) or ExecuteBatch (any number of commands). It is significantly faster to send one request with multiple commands over multiple requests. Batch statements are executed in a single transaction. If one of the commands fail all the batch commands will be cancelled (roll-backed).

Note that for non-select requests, Rows field in the results will hold an array with a single int for each command. The int value is the number of affected rows (for each command separately).

Initializing DBRequestManager:
B4X:
Sub Activity_Create(FirstTime As Boolean)
   If FirstTime Then
     reqManager.Initialize(Me, "http://192.168.0.100:17178")
   End If
End Sub
The first parameter is the module that will handle the JobDone event.
The second parameter is the link to the Java server (with the port number).

DBRequestManager provides the following helper methods for common tasks related to BLOB fields: FileToBytes, ImageToBytes and BytesToImage.It also includes a method named PrintTable that prints DBTable objects to the logs.

Framework Setup
  1. Unpack the server zip file.
  2. You will need to download the driver for your database platform and copy the jar file to jdbc_driver folder.
  3. Edit config.properties as discussed above.
  4. Edit RunRLC.bat and set the path to java.exe. If you are running it on Linux then you need to create a similar script with the path to java. On Linux you should change the ';' separator to ':'.
  5. Run the server :)
    You should see something like:

    SS-2013-08-04_17.05.16.png


    Note that the path to config.properties is printed in the second line.
  6. Add an exception for the server port in your firewall.
  7. Try to access the server from the browser:

    SS-2013-08-04_17.06.17.png


    You will probably not see the above message on the first run :(. Instead you will need to check the server output and read the error message.
    If you are able to call the server from the local computer and not from other devices then it is a firewall issue.

Tips

  • MySQL driver is available here: http://dev.mysql.com/downloads/connector/j/
  • Google for <your database> JDBC Driver to find the required driver. For SQL Server you can use this open source project: http://jtds.sourceforge.net/
  • The server uses an open source project named c3p0 to manage the database connection pool. It can be configured if needed by modifying the c3p0.properties file.
  • Use a text editor such as Notepad++ to edit the properties file.
  • If you are running the server on Linux then you can run it with nohup to prevent the OS from killing the process when you log out.
  • Java doesn't need to be installed. You can just unpack the files.
The server is based on the two following open source projects:
Jetty - http://www.eclipse.org/jetty/
c3p0 - http://www.mchange.com/projects/c3p0/index.html

Current version (0.9) is considered a BETA version.
 

aklisiewicz

Active Member
Licensed User
Longtime User
RemoteServer is running (Thu Dec 26 23:29:45 CST 2013)
java.sql.SQLException: An attempt by a client to checkout a Connection has timed out.

modified configuration file, and I see the server is runing but connection attempt fails.
Any ideas ?

URL: http://192.168.1.76:17178/?method=test


my config ->
--------------------------------------------------------
B4X:
#Lines starting with '#' are comments.
#Backslash character at the end of line means that the command continues in the next line.
#DriverClass=com.mysql.jdbc.Driver
#JdbcUrl=jdbc:mysql://localhost/test?characterEncoding=utf8

DriverClass=org.sqlite.JDBC
JdbcUrl=jdbc:sqlite:C:\DATA\PROJECTS_B4A\EDBQ_MOBILE\database\edbmo.db3

#SQL Server
#DriverClass=net.sourceforge.jtds.jdbc.Driver
#JdbcUrl=jdbc:jtds:sqlserver://<database server ip>/<database>
User=root
Password=
ServerPort=17178
#If Debug is true then this file will be reloaded on every query.
#This is useful if you need to modify the queries.
Debug=true

#commands
sql.create_table=CREATE TABLE animals (\
    id INT NOT NULL AUTO_INCREMENT,\
    name CHAR(30) NOT NULL,\
    image BLOB,\
    PRIMARY KEY (id))
sql.insert_animal=INSERT INTO animals VALUES (null, ?,?)
sql.select_animal=SELECT name, image FROM animals WHERE name = ?
 
Status
Not open for further replies.
Top