JDBC . can the database be exported with the jar file? - java

Recently, I constructed a java application that uses JDBC in order to connect to mysql. The question is this: if I export the java application as a jar file, does the database itself gets exported with the jar file? In other words, can the application still connect to the database (mysql) on any pc?

No you can't, JDBC is an API that defines how a client interacts with the database, it's a separate thing.

Related

How to inject MySQL database into the project folder

How to put the MySQL database in the folder with the java project so that the program connects and behaves appropriately with this database, if it is possible of course.

Java Application Deploying With SQL Server Database

I developed a java swing application by using hibernate connection and MS SQL server for database. Application is working fine. And I know the way to create and EXE and the installer for application.My question is, how I install this application to another computer with database. Should I install the SQL server on that computer or is there any way to use the db without installing the whole SQL server in that computer.
As far as i know there is no way of using database without installing the SQL Server, unless you configure in a way that the application will communicate with the db on your pc, but that's complicated
A different approach to this would be for you to make a view in the database and extract the data you need to a csv file, include that file in the resources folder of the application and then use Lucene to query over it
Take a look at how to get started: here
When you need to update the data in the file you can release updates for the application that would include these changes in the csv file/s

How deploy java derby application for distribution to other clients

I have developed an application which works with derby database, all things are ok on my machine, i started the database server from the netbeans.
Is there any method to copy the database structure and data for distribution to my clients?
All you need to do is to copy the contents of the database folder as is.
The database directory consists usually of one file service.properties and two directories: log and seg0.
If your application is the only one accessing this database on the client, then you should consider to use embedded mode, to avoid the installation of the Derby network server.

Java JAR File and Database Connection

I would like to ask a question about jar and database connection. I performed an application and converted to jar file. Jar file works if I open NetBeans's Service which is server(I have created my tables on jdbc:derby://localhost:1527/sample). But I want to open jar file without opening NetBeans and its service server. The application should work on other PCs if the jar file clicks.
I have searched a lot about this but I do not know how I can do. For example, if I use file database (MSAccess) with ucanaccess driver, will this support JPA(Entity Beans) and JDBC ? Because I have used JPA and JDBC together in my application. I have also searched embedded database but when I create the embedded database and table, I can not access table. It gives me an error which is "Table/View does not exist".
Please help me.
What should I do if I use JDBC and JPA together in my application ?
And If I want to open the jar file other PCs and they can reach database information, what should I do ?
Best regards.
I am new to derby+Netbeans, but from your explanation and this link -
https://netbeans.org/kb/docs/ide/java-db.html#configuring
It seems you are using internal Java DB which comes with Netbeans Glassfish server.
Therefore when you start the server from netbeans it works.
Try external installation of database as shown in the above given link. It should work outside Netbeans.

embed mysql database in java application

I make a java application using netbeans that connect to database , but i have a problem , i want to embed mysql database with the executable jar file , so when i take this jar file and run it on any pc that doesn't have mysql server it will run with database , i thought about include the mysql-installer.exe and make a script to install the mysql server , but i can't find how to do that ,also i read about Connector/MXJ does it work if the user run the application and he does not have mysql server , any suggestion or article about this.
Derby is a pure-java DBMS. You bundle the derby jar with your program, just as you would any other library. This is a much cleaner way of ensuring your user has a db for your program, as you're not adding any dependencies.
Usually distributors don't include standalone databases, such as MySQL or Oracle, with their
application. If needed, they provide SQL script to build the database and make the user type in the database host, username and password and make a script to build the database. If you want to "ship" the database with your application then I would consider more lightweight databases such SQLite (singe file database).

Categories

Resources