Android Question CLOSED / SOLVED JdbcSQL - A little help please

OliverA

Expert
Licensed User
Longtime User
"net.sourceforge.jtds.jdbc.Driver"
That’s for connecting to MS SQL. Use
"com.mysql.jdbc.Driver"
and connector/j to connect to MySQL. For 32 bit, you can use up to version 5.x and for 64 bit use the 8.x version. After downloading the proper .jar file for the driver, place it into you additional libraries folder and then include it via the #AdditionalJar directive.

Link:
Note: Select platform independent version for Windows
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
I guess this is where I am really confused. I use FatCow as my hosting agent and they allow me to have a MySQL server.

1601908912331.png


I trying to connect to their server using my Android device.

Which connector would I choose?
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
I use FatCow as my hosting agent
Which connector would I choose?
1) Most likely none, since I'm pretty sure that FatCow does not allow external access to the MySQL database (most hosts don't). If you want external access to a DB, you could a) go for a VPS or b) go for DB hosting (AWS, Azure, etc.)
2) Actually, with Android, you may need to stick with the 5.x drivers (I think the 8.x drivers will fail). Testing will validate or invalidate this answer.
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
FatCow platform type is Debian

Tried with those drivers and the driver requires minsdk of 26 (so I set min to 27 and target to 29) and still get these errors

1601910101681.png


I believe I will take OliverA advice and try AWS (I believe it's free)
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
I believe I will take OliverA advice and try AWS (I believe it's free)
That will not solve your error message. Which versions of the connector have your tried?
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
I just compiled using mysql-connector-java-5.1.49.jar and mysql-connector-java-5.1.49-bin.jar w/o the errors you are experiencing above.
B4A: 10.0
Java JDK: OpenJDK 11.0.1 from B4X's site
Windows: 10 Pro (2004)
Manifest: <uses-sdk android:minSdkVersion="5" android:targetSdkVersion="28"/>
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
Using mysql-connector-java-8.0.21, I get your errors, but then I expected 8.x to fail (Android's Java - 1.7 - is getting a tad old for all the new Java stuff coming out).

Note: Previously I did not mention that 8.x may fail. But that was an answer w/o coffee...
 
Upvote 0

Bladimir Silva Toro

Active Member
Licensed User
Longtime User
Hello @Robert Valentino

The problem with most hosting is that they do not support remote connections to the databases that they include in their hosting packages.

Check if your FatCow hosting supports remote connections to the MySQL database

You can try on the website https://remotemysql.com/ create a MySQL database is free and allows remote connections.

Do the tests with B4A it should work without any problem
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
From what I have read on Stackoverflow it is possible.

1601914777546.png


1601914834012.png


Here is the PHP code that was generated:

B4X:
 <?php
$link = mysql_connect('*me*.fatcowmysql.com', 'bbs', '*password*');
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_select_db(bbs);
?>

I think if I could figure out the right connectors I could get it to work.


BUT I will look remotemysql.com

I'm down for trying ANY Ideas. Thanks folks
 
Upvote 0

Bladimir Silva Toro

Active Member
Licensed User
Longtime User
Hello @Robert Valentino

You can check if your database supports remote connections for this follow these steps:

1. Download HeidiSQL at the following link: https://www.heidisql.com/download.php

2. Install on your PC - create a new connection

3. Write the data of your hosting the ip address, the username and password of your database

4. Click on Open if it connects is that your hosting does support remote connection

I leave you the photos of the tests with the remotemysql.com hosting

1601916866741.png


1601916902980.png


Do this with your FatCow hosting and tell me if you could connect.
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
HeidiSQL wouldn't work and it is because they do not allow it.
I had it working using the example: https://www.b4x.com/android/forum/t...hp-mysql-server-xampp-with-b4a.48635/#content
But after an hour or so they shut it down on me. I guess I should have realized that it was a problem when I couldn't upload a PHP had to upload it as a txt file and then rename it. But at least I have the code for something like this and have learned something in the process.

They suggested https://www.ipage.com/vps-hosting but the small amount of money my app generates, cannot handle $20 bucks a month.

Was trying the https://remotemysql.com/ that was suggested. But you have to take all these Surveys to be able to do anything. I guess I didn't answer the questions the way they wanted (I give out very little information to anyone - once bitten by ID theft, lesson learned)

Will keep searching for a free remote SQL server
 
Upvote 0

Bladimir Silva Toro

Active Member
Licensed User
Longtime User
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
I agree. I signed up for the remotemysql.com but can't find a way of uploading a php to it and haven't been able to connect using connectors.

Boy, I am 70 so this stuff is like pulling the few real teeth I have. Think I would rather a poke in the eye with a sharp stick.

Guess, I will have to try a site that charges very little.
 
Upvote 0

Bladimir Silva Toro

Active Member
Licensed User
Longtime User
I agree. I signed up for the remotemysql.com but can't find a way of uploading a php to it and haven't been able to connect using connectors.

Boy, I am 70 so this stuff is like pulling the few real teeth I have. Think I would rather a poke in the eye with a sharp stick.

Guess, I will have to try a site that charges very little.


Hello @Robert Valentino

Look at the hosting remotemysql.com only offers the possibility of having a MySQL database that can be accessed remotely.

Look at the example attached there is this for example how to make a SELECT query to the remote database.
 

Attachments

  • JdbcSQL Example RemoteMySQL.zip
    8.2 KB · Views: 170
Upvote 0

yfleury

Active Member
Licensed User
Longtime User
I have a server at home and I use jrdc2 server on it. My app make connection to jrdc2 sever and do everything on mysql database. It not so difficult to build it and it's very fast to transfer data from app to server or server to app. Cost 0$.
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
A server at home wouldn't work for me.
We are on satellite internet, slow as molasses going up hill on a winter day. Not to mention if it's raining too hard it's unavailable.

As for SQL, I'm good at that. I just keeping getting in the unfiltered logs no connector. I've got to just find the right jar file.

Calling it a day. Need to get ready for the Packer day. Wife has chores for me to do before game. Lol
 
Upvote 0
Top