Installer package for program that uses JDBC to connect to MySQL - jdbc

I have an installer wizard thing called 'install creator'. I want to include my mySQL database into the installer or find another way that the user, upon installation, can just use my database. Prob is-not everyone has MySQL installed on the computer and even then, the user doesn't know the name of the database or my password. Somehow the database must be created automatically upon install, and for my purposes, some of the tables created. How can one do this. Thanks

If you are just using MySQL as a local storage engine, as it seems to be what you are doing, then you should consider using Sqlite with JDBC, instead of MySQL. MySQL is really intended to be used on a server, where information from multiple users is stored, and where the database is accessed only indirectly through the programs that you create that run on the server. You could, in theory, package up MySQL and MySQL Connector/J which lets JDBC talk with MySQL; however, MySQL is a pretty big beast, and I don't think it's nice to do that to your users (also, don't forget that they might already have MySQL installed, and if you were to install MySQL for the first time, you would effectively be forcing them to use your root password). Unlike MySQL, sqlite is intended to provide the structure of SQL for use with lightweight, local file storage.

Related

Is Oracle Database Supported in Joomla?

I would like to use Oracle database instead of MySQL in Joomla. Is this possible with Joomla, is there a workaround or a solution on how to implement Oracle database with Joomla? Any information will be greatly appreciated.
It is said that it can be done, but it is not a job for beginners and took those guys 3 working days to do it.
Here's why that combination doesn't work by default:
The database and table creation script does not work without modification.
The connection and the database class are written to connect to MySQL and not to Oracle (so they all use MySQL functions).
Some of the extensions use native MySQL functions directly, instead of connecting using the Joomla Database interface (class).
This is what they did to make it work:
We fix the SQL installation script to accommodate the Oracle database in case of a new installation. In case of an existing installation, we export all the database, as well as its data to a SQL file, and then we modify the SQL file (using find and replace) to make it work with an Oracle database.
We load the modified installation file or the modified exported SQL file into the Oracle database.
We then create a copy of the Joomla database class, and then we modify all the functions to work with Oracle instead of MySQL.
We ensure that the Oracle drivers are properly installed and loaded by the php.ini file.
We rename the original MySQL database (you will know in the next step why) to something like database_name_old.
We switch to the new database class and fully test the website to see if some extensions are not working. If an extension ceases to work then it is a sign that this extensions is calling the original MySQL database (which no longer exists because it was renamed) directly.
Hopefully, you aren't a beginner and those guidelines will help you do it. Otherwise, check how much it might cost by visiting the page.

Change Oracle Apex apps to another Database on same system

Good Day. I have a situation which I am unsure of how to solve. I have searched numerous places and found nothing concrete.
The scenario:
I have 3 Oracle Apex 5 applications running on a single server using Oracle Express locally in order to run the app. I however had to go to Oracle 12c which is installed as a separate instance on the same server and it's listener is now listening on 1522 where XE is still listening on 1521.
I am needing to find a way to export the schema, tables, apps etc. into 12C from XE, then simply configure the apps to connect to the 12C instance and no longer on XE. I can then remove XE completely.
I know I am supposed to post what I have tried, but simply have no code, I have tried to do a export DDL but the script does not seem to carry the Schema data at all.
Question: How can I migrate everything on the XE instance to the 12C instance without breaking either instances.
Any direction would be appreciated.
Two steps: data(base) migration & (Apex) application migration.
The simplest way to move data is to perform export and import. Although you can use the original EXP and IMP utilities, consider using modern Data Pump Export and Import.
EXP and IMP are somewhat simpler; export (DMP) file is created on your disk
Data Pump requires you to create an Oracle directory (object) which points to a directory on the disk. As it is XE installed on your computer, no problem if it is, for example, C:\Temp
syntax is very similar in both cases, especially if there's nothing fancy in your data
The second step is application migration; you should first install Apex in the new Oracle 12c. Make sure it is up and running (create a workspace, assign a schema (you've just imported) to it, create a developer).
Then export the Apex application(s) - if there are only a few of them, a simple way is to do export from the application itself (you'll see the "Export/Import" button in the "main" application page within the App. Builder). Follow the wizard. The result will be a plain textual (.SQL) file.
In Apex on 12c, revert the process - do the Import by navigating to previously exported .SQL file, follow the wizard once again. Once the import is finished, you should be able to run the application.
Good luck!

How can I make local connection in Oracle SQL Developer?

I have downloaded the SQL Developer. Currently, I am using my school database but it is for temporary use. I want to use it after finishing my college. I do not know how can I make local connection in SQL Developer. Can you please help me in this.
Oracle SQL Developer is a tool you use to access an Oracle database.
So, if you want to use Oracle on your own computer, regardless there is (or is not) a connection to your school network, you'll have to install the database as well. I'd suggest Oracle 11g Express Edition. The installation process is simple; more or less, clicking NEXT a few times does the job. I'd, though, recommend you to follow the Installation Guide and pay attention to what the Installer asks (for example, write down passwords you choose).
Furthermore, in order to "copy" the database (actually, I believe you mean "schema" in this case) to your database, the right way to do that is to use Data Pump. You'd use Export in school to export the database, and Import on your computer to import it.
However, as Data Pump requires access to a directory (it is an Oracle object which points to a file system directory, usually on the database server; it is created by SYS and other users are granted read and/or write privileges on it). If you can't get access to it, you can use the original EXP and IMP utilities. EXP creates the DMP file locally; you'd put it onto a memory stick (or, if you're on the network, copy it directly to your PC) and import it.
If you're unsure of whether you can (or can not) do that, ask your teacher.
Once the schema is imported into your database, use SQL Developer to access it. Should be no problem to do that.

Oracle Data Pump expdp to local computer that does not have oracle installed

Hi I've been reading this instruction:
http://www.oracle-base.com/articles/10g/oracle-data-pump-10g.php#NetworkExportsImports
From my understanding, I need to login my local oracle database, establish a database link to the remote oracle server, then use expdp to export database to local.
But now I only have sqlplus installed in local computer, how can I expdp to local?
Thank you very much.
You can't. expdp only works locally. The database link is just a kludge to make the Oracle instance on your current machine be able to see the data in the other database. If you truly need a remote back up, your only non-custom or third party option would be exp, but that's deprecated. (I'm not aware of any third party solutions, either.)
Another option to consider is running the command on the remote server and then using something else to copy the file. This is more feasible if you run a Linux server, since you can likely use SSH and SFTP.
You could try Oracle Express on your local machine if you want to pursue the database link option. That is a very heavy solution, of course.
(In all honesty, I have had endless troubles with expdp anyway. Well, more with impdp, but still. The data dump/restore situation in Oracle is not very good, in my opinion.)

Embedded or managed Oracle instance for integration tests

For MySQL, the MXJ connector makes it very easy to launch a managed MySQL instance.
I know that Oracle provides Oracle XE for quick setup, but I've only found an RPM distribution that needs to be installed. Is there a neatly packaged jar that I can just drop in the classpath and start up by calling a specific JDBC url, a la HSQLDB or MXJ?
I'm interested in having developers use this locally for running tests, as well as on our continuous integration server.
The short answer is No. Oracle is a big meaty chunk of database. Amongst other things, it generally expects itself to be run by its own special user rather than the client user.
For simplicity, your best bet is a separate DB server with each of your developers having their own username/password (and hence their own independent schema) in the database.
Although Oracle does not provide an embedded database, spinning up a local Docker container running Oracle XE might be an ideal way to accommodate Oracle-specific local integration tests. Since Docker containers are ephemeral in nature by design, the database could also be completely torn down as desired providing clean sandboxing.
The alexeiled/docker-oracle-xe-11g image on DockerHub I found has particularly clear setup and documentation instructions: https://hub.docker.com/r/alexeiled/docker-oracle-xe-11g/
After spinning up the Docker container, be sure to:
First connect to the APEX web console, login, as per the instructions
Then open Oracle SQL Developer and select Reset Password... first. Otherwise the following error may be thrown java.lang.ArithmeticException when attempting to get connection in Oracle 11.2.0.2.0 (64 bit)
As the documentation describes, the docker run command can also be designed to automatically run SQL scripts on the container's startup, which could also be very valuable in the CI/integration testing workflow.
Hope this helps!

Resources