Win a copy of Transfer Learning for Natural Language Processing (MEAP) this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

Java application and remotely accessing a MySQL database

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Friends;
Good day. I just Complete the small database application only with one table,by using Mysql @localhost.
Now i want to move access the database remotely. For practice i use the free account from https://www.db4free.net/.
Please guide me how i access the remote database from java application.Please send me an article or link where step by step instructions are explained.
One of my friend have a domain, he install mysql and give me a link also but i am not familiar how to use or configure it.

Regards
 
Saloon Keeper
Posts: 6384
158
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not following - you're using some free service for testing, but you don't understand how to use it? So you are not yet using it? Does it not come with instructions?

If you don't know how to use your friend's host, surely you can ask him for details.
 
Sheriff
Posts: 7056
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is a link with a JDBC tutorial.  JDBC is one way to access a database from Java.

https://docs.oracle.com/javase/tutorial/jdbc/basics/index.html
 
Hamad Sultan
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Friends;
Thanks for the link i did it. Now i observe that when sql queries run it takes time than the localhost. I want to add progress bar or set a cursor to as a WAIT cursor till data insert,update and select queries complete their job.

I search the web but i am unable to find any example of JProgressBar or change cursor.

Please guide me how i achieve this task with an example.

I hope friend you help me in this regard.

Thanks  

 
Knute Snortum
Sheriff
Posts: 7056
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That sounds like you're going to use Swing.  I'll add this thread to that forum.
 
Rancher
Posts: 3158
29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I search the web but i am unable to find any example of JProgressBar


Here is a link to the Swing Tuturial

There is a section on "How to Use Progress Bars".
 
Hamad Sultan
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the link. I read it but i am still stuck how to use progressbar with Mysql Data when resultSet fetch record and sql queries use as a executeUpdate.

Please give me one shor example.

Regards
 
Marshal
Posts: 25452
65
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Most progress bars that I'm familiar with tell you that the process is 10% complete, then 20% complete, and so on. Is that the sort of thing you hoped to produce?

If so then, if you think about it for a bit you will realize that to do that you need to know in advance the time the process will take to run. I don't believe that MySQL, or indeed any database system at all, will provide that information.

But as the tutorial says, there's a version of JProgressBar which deals with that issue. The tutorial also has a suggestion about another way you can tell the user that some work is taking place.
 
Hamad Sultan
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Paul;

Can you guide me about the other way? Ok i agree with your reply that JProgressBar not used in sql queries.

Please guide me the other way?

Regards
 
Paul Clapham
Marshal
Posts: 25452
65
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's the part of the tutorial which starts out like this:

Another way of indicating work is to set the wait cursor, using the Cursor class and the Component-defined setCursor method. For example, the following code makes the wait cursor be displayed when the cursor is over container (including any components it contains that have no cursor specified):

 
Hamad Sultan
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Friends;

Good day. I face some problem and when database connection try for the connection the following exception generate:
"The server time zone value 'CDT' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the 'serverTimezone' configuration property) to use a more specifc time zone value if you want to utilize time zone support."

While i use the remote database and the parameters are
class1=com.mysql.cj.jdbc.Driver
USER1=mycompas_turbine
PASS1=1111
URL1=jdbc\:mysql\://some address\:3306/mycompas_info


Class.forName(class1);
conn1=DriverManager.getConnection(URL1,USER1,PASS1);

How can i fix this issue? On the server where mysql install is not a dedicated server for me. I just pay for a domain and install mysql and configure it through CPANEL.

How i add the time zone in DriverManager.GetConnection(URL1,USER1,PASS1+???);

I live in Pakistan please help me how i fix it?

Regards
 
Ranch Foreman
Posts: 95
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First: When a Type 4 JDBC driver is in classpath you don't need this Class.forName() - you can savely remove it without any replacement. That's an old style before JDBC4 with ServiceLoader were a thing.

Then: That weird timezone issue is something MySQL (Oracle) came up with, MariaDB doesn'T seem to have this issue, but to fix it add this to your jdbc-url: "?serverTimezone=UTC"

For your overall idea about using a remote database server: Although possible (and also in a secure way (with TLS)): just don't do it.
 
Doody calls. I would really rather that it didn't. Comfort me wise and sterile tiny ad:
ScroogeXHTML 8.7 - RTF to HTML5 and XHTML converter
https://coderanch.com/t/730700/ScroogeXHTML-RTF-HTML-XHTML-converter
    Bookmark Topic Watch Topic
  • New Topic