Our Java application works as the following:
- it connects to the server without specifying any database name,
- checks if the given database exists and creates a new one if not.
On Windows, the application works fine but on Linux it cannot connect to the server. The error message: "monetdbd: please specify a database".
We would like to run the same Java application on Linux and Windows. Is there any method to check and create database from Java on both operating system?
We have figured it out at last. A client can connect to an existing database only. On Windows the installer creates a demo database. If other database is not specified, the client connects to it automatically.
On Linux the installer does not create any database, so it should be created
manually.
Related
simple question is that.
we made one application that store information.
but .exe provide to the client.
client not installing any database.
we make like, IDM, VLC, brower application
that application does not ask any database installing creating a database.
Try To Microsoft Access But This Client Must Be Use Window Operating System
I have created a standalone application as a school project. The major problem we are encountering is that since it has Java as front-end and MySQL as back-end (compulsory), and we have created a database that solely belongs to one computer, we cannot run the same project on different machines because it won't have the required database, the tables, or the same username and password we used to connect to MySQL.
So my question is **How can I connect to MySQL server in different Machines? **
For database and Tables, I could run a sql file, but that will happen when I would be connected to the MySQL server. Also I am developing the project at my home computer, and I want to run the project on different computers who are connected to my computer by no means .
You a following options
Shared drive : Attach database stored on remote shared drive to a local SQL Server read here
Connect to remote SQL Server instance from local computer - better if they are in same LAN - Steps here
If you want to package DB with app where you have predefined data and you dont want to save transactional data - use inMemory DB. They will load when you application starts up.
Already your application can work using different machine.
You have only to change the localhost string in your connection string with the IP of the MySQL machine :
DriverManager.getConnection("jdbc:mysql://localhost/database?"+ "user=sqluser&password=sqluserpw");
And make sure that remote access are enabled in your MySQL configuration. You can find more about it here.
Instead of using localhost in your database connection string, you should use the ip or aname of the database host
e.g.
jdbc:mysql://IP:3306/db?user=user&password=password
jdbc:mysql://A-NAME/db?user=user&password=password
Just make sure that port 3306 is open and that you have access on the system the databasse is hosted on
I m deploying java desktop application on client machine.used mysql database,
how to connect to database without install any environment on client machine ?
You must ship/deliver your client (desktop) application with the JDBC driver (assuming you are NOT using ODBC) for MySQL...that's it!
UPDATE
Of course, make sure it is available in the Java classpath.
If a java desktop application from a client machine needs to connect to a database on an external central server (on another machine), kind of like a php script that can connect from a browser on the client machine to a database, how would that be accomplished? I know that you can use JDBC, but wouldn't the person who's running the desktop application need mysql connector/j driver installed on his/her computer?
As long as you bundle the appropriate JDBC driver (usually a jar) with the application and make sure it's on the runtime classpath everything should work. There is no "installation" of the driver separate from having the appropriate classes on the application's classpath.
Of course: if an application is using JDBC to connect to a DB they'll need the appropriate JDBC driver.
Most applications already have a set of library dependencies; it would just be another one.
I am attempting to create a MySQL DB and Java client app for my home network. I haven't really had any experience with MySQL other than PHPMyAdmin for a website backend (also have used SQLite). I have downloaded the full MySQL installation and a test DB from the MySQL website. On the server machine I successfully connected to the DB as root. Not a difficult task.
Now I want to connect to the DB from my client PC, just to check I can. Eventually I will use the JDBC driver to connect from my Java client app, but before that I just want to check I can connect.
How should I do this? SHould I just install the MySQL command line program onto the client PC?
EXTRA INFO: forgot to add, I'm using Windows 7 on all my machines.
Yes, you could install the MySQL to get MySQL command line program and connect with it, but also you can use another MySQL client tool like PHPMyAdmin, dbForge Studio for MySQL or another one.
To connect from remote host you should create special accout for it, e.g. - 'user_name'#'your_host_name'. Find more information here -
Specifying Account Names
Account Names and Passwords