Android Question [UNSOLVED YET] RDC Problem at VPS

killiak

Member
Licensed User
Longtime User
Ok, first of all let me said that i'm done....don't know what else to do

Ok, i try to connect to a Mysql in my VPS (Heide SQL Runs perfect) Have root permition and i create a full user for the DB.

Install the jRDC.jar in the server and it's seems to working fine. So i try the RDC Example for B4J. i put the Northwind database in the server

after a LOT (A LOT!) of errors i finally come to this and no matter what i change... it always the same error... now, first the error

B4X:
Program started.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
<title>Error 500 </title>
</head>
<body>
<h2>HTTP ERROR: 500</h2>
<p>Problem accessing /rdc. Reason:
<pre>    com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near &apos;null&apos; at line 1</pre></p>
<hr /><a href="http://eclipse.org/jetty">Powered by Jetty:// 9.3.z-SNAPSHOT</a><hr/>
</body>
</html>
MAl: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'null' at line 1

I try to google it and there is not to much clear info about ir.

Now the code (RDC Example actually)

B4X:
#Region  Project Attributes
    #MainFormWidth: 500
    #MainFormHeight: 500
#End Region

Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
    Dim reqManager As DBRequestManager
    Dim TableView1 As TableView
End Sub

Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    'MainForm.RootPane.LoadLayout("Layout1") 'Load the layout file.
    MainForm.Show
    TableView1.Initialize("TableView1")
    MainForm.RootPane.AddNode(TableView1, 0, 0, 0, 0)
    MainForm.RootPane.SetAnchors(TableView1, 0, 0,0, 0) 'fill the screen
    reqManager.Initialize(Me, "http://XXX.XXX.XXX.XXX:17178/rdc")
    GetCostumer("data")
End Sub

Sub GetCostumer(test As String)
    Dim cmd As DBCommand
    cmd.Initialize
    cmd.Name = "select_Customers"
    cmd.Parameters = Array As Object()
    reqManager.ExecuteQuery(cmd, 0, Null)
End Sub


Sub JobDone(Job As HttpJob)
    If Job.Success = False Then
        Log("MAl: " & Job.ErrorMessage)
    Else
        If Job.JobName = "DBRequest" Then
            Dim result As DBResult = reqManager.HandleJob(Job)
            reqManager.PrintTable(result)
            reqManager.FillTableView(result, TableView1)
            MainForm_Resize(MainForm.Width, MainForm.Height)
        End If
    End If
    Job.Release
End Sub

Sub MainForm_Resize (Width As Double, Height As Double)
    For i = 0 To TableView1.ColumnsCount - 1
        TableView1.SetColumnWidth(i, (Width - 10dip)/ TableView1.ColumnsCount)
    Next
End Sub

now the config.properties

B4X:
DriverClass=com.mysql.jdbc.Driver
JdbcUrl=jdbc:mydql://127.0.0.1:3306/northwind
user=yeahright
Password=yabadabadooo
#Java server port=17178
sql.select_Customers=SELECT CompanyName FROM Customers
#example of MS SQL Server configuration:
#DriverClass=net.sourceforge.jtds.jdbc.Driver
#JdbcUrl=jdbc:jtds:sqlserver://<server address>/<database>


WHAT I TRY... In the client code
change cmd.Name = "select_Customers" to cmd.Name = "sql.select_Customers"
Same error

In the confir properties
Taking out 3306 Mysql Port
Change Localhost to 127.0.0.1
Change "Select * FROM Customers" to "Select CompanyName FROM Customers" to "SELECT CompanyName FROM northwind.Customers...
Same error



If some1 please help me i really apreciate it....Thanx!
 
Last edited:

killiak

Member
Licensed User
Longtime User
Can you show the command on config file?
Sorry, i don't follow...you mean config.properties? i add it in the #1 post
 
Upvote 0

killiak

Member
Licensed User
Longtime User
Seen an issue... correct:
JdbcUrl=jdbc:mydql://127.0.0.1:3306/northwind
in
JdbcUrl=jdbc:mysql://127.0.0.1:3306/northwind

Ciao
Mauro
Fixed... nothing happen
 
Upvote 0

tigrot

Well-Known Member
Licensed User
Longtime User
With the correct driver everything runs better! The strange is that there is a "code 500" answer from RDC, so there is a connection between the APP and the RDC itself. So Killiak is using a driver, but probably not the right one.
Have a nice week!
 
Upvote 0

killiak

Member
Licensed User
Longtime User
What kind of database is mydql???
Shouldn´t it not be mysql?
Yes...i fix that, nothing change
thx

With the correct driver everything runs better! The strange is that there is a "code 500" answer from RDC, so there is a connection between the APP and the RDC itself. So Killiak is using a driver, but probably not the right one.
Have a nice week!

Thx Tigro... changed it...



Thanks Erel... i download and put the tar.gr in the /JAR/ where i have the jRDC... delete the other one...chage the config.properties for the MariaDb Structure as

B4X:
#Lines starting with '#' are comments.

DriverClass=org.mariadb.jdbc.Driver
JdbcUrl=jdbc:mariadb://localhost:3306/northwind
user=blahblah
Password=Yabadabadoo
sql.selectstomers=SELECT CompanyName FROM Customers


#SQL COMMANDS

One thing, when i start the jRDC.jar... this come out... and i was wodering why is a 0.0.0.0:17178 there

B4X:
 java -jar /JAR/jRDC.jar
2016-01-25 08:13:18.502:INFO::main: Logging initialized @201ms
Jan 25, 2016 8:13:18 AM com.mchange.v2.log.MLog <clinit>
INFO: MLog clients using java 1.4+ standard logging.
Jan 25, 2016 8:13:18 AM com.mchange.v2.c3p0.C3P0Registry banner
INFO: Initializing c3p0-0.9.2.1 [built 20-March-2013 11:16:28 +0000; debug? true; trace: 10]
2016-01-25 08:13:18.954:INFO:oejs.Server:main: jetty-9.3.z-SNAPSHOT
2016-01-25 08:13:19.044:INFO:oejsh.ContextHandler:main: Started o.e.j.s.ServletContextHandler@4f933fd1{/,file:///JAR/www,AVAILABLE}
2016-01-25 08:13:19.051:INFO:oejs.AbstractNCSARequestLog:main: Opened /JAR/logs/b4j-2016_01_25.request.log
2016-01-25 08:13:19.100:INFO:oejs.ServerConnector:main: Started ServerConnector@14acaea5{HTTP/1.1,[http/1.1]}{0.0.0.0:17178}
2016-01-25 08:13:19.104:INFO:oejs.Server:main: Started @808ms
jRDC is running (version = 2)
 
Upvote 0

killiak

Member
Licensed User
Longtime User
I someone what to get to my VPS be my guest.... i send the details...

Plase help me
 
Upvote 0

killiak

Member
Licensed User
Longtime User
It is not related. It means that it listens on all network interfaces.
What happens when you send a query? Can you post the server logs?

Today logs

190.55.248.131 - - [25/Jan/2016:12:28:40 +0000] "POST //XX.XX.XX.XX:17178/rdc?method=query HTTP/1.1" 500 530 "-" "-"
190.55.248.131 - - [25/Jan/2016:12:59:40 +0000] "POST //XX.XX.XX.XX:17178/rdc?method=query HTTP/1.1" 500 530 "-" "-"


Same as 21...22...23....24... Always the same
 
Upvote 0

killiak

Member
Licensed User
Longtime User
Ok, this is my code. I'm sending you my vps IP in private

 
Upvote 0

killiak

Member
Licensed User
Longtime User
Sorry but you haven't answered any of my questions.
sorry... but i don't understand what you asking me (complete newbie i'm afraid)

What happens when you send a query?

Within b4J or with HEidi? with B4J code nothing, error...with Heidi perfect! runs fast as hell

Which error do you get?

With b4J, this

B4X:
Program started.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
<title>Error 500 </title>
</head>
<body>
<h2>HTTP ERROR: 500</h2>
<p>Problem accessing /rdc. Reason:
<pre>    com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near &apos;null&apos; at line 1</pre></p>
<hr /><a href="http://eclipse.org/jetty">Powered by Jetty:// 9.3.z-SNAPSHOT</a><hr/>
</body>
</html>
MAl: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'null' at line 1



You should post the server output not logs.

- Sorry, i don't understand this, where should i find it? the only place that i found logs was in the /logs/ and i was just what i tell you before

B4X:
190.55.248.131 - - [25/Jan/2016:12:28:40 +0000] "POST //XX.XX.XX.XX:17178/rdc?method=query HTTP/1.1" 500 530 "-" "-"
190.55.248.131 - - [25/Jan/2016:12:59:40 +0000] "POST //XX.XX.XX.XX:17178/rdc?method=query HTTP/1.1" 500 530 "-" "-"


Sorry...maybe something i'm missing... Thanks
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…