I know that it's a very undesireable scenario, but I need to create a database straight from java code. Yes, a database. Not a table. A database. The database will be dropped at the end of the program and will never be directly touched by the user, so all I'm really concerned with is the actual creation.
Also, using a pre-existing database as a jumping point isn't really an option.
I'm certain there must be some way to do this, but I haven't really found anything yet that sounds very promising....is this actually possible?
I'm more confused by the question. Do you want to literally write a database software/server, or do you desire to connect to a pre-existing database server such as MySQL and then run SQl like "CREATE DATABASE mydb;". If you are trying to do the first then it seem like Ezzaral's suggestion has that covered. If you want to just connect to a dbserver, then there are db drivers available like JDBC and Connector/J. There is also Java DB.
Ezzaral's suggest does in fact seem like exactly what I was looking for. However, I'm still trying to get H2 working (I'm having trouble setting the classpath?), and I didn't want to mark this as answered if H2 did not end up working.
The problem I'm having at the moment is that I have never worked with multiple packages or assigning classpaths before. I understand how it -should- work, but that doesn't seem to be working. What I'm trying is:
c:>java -classpath C:\H2\src\main org.h2
Am I missing something that should be painfully obvious?
c:\>java -cp C:/H2/bin/h2-1.2.141.jar org.h2
c:\>java -cp C:/H2/bin/h2-1.2.141.jar org
Exception in thread "main" java.lang.NoClassDefFoundError: org/h2
The way I'm understanding it, I need to specify a directory for java to start in when looking for classes. So if I set the classpath to look in the "org" directory, then java will start there, go to h2, then go to Driver.class when the program tries Class.forName("org.h2.Driver").
Perhaps what I'm really looking for is just a "if you set the classpath to <this>, it will take the input and be happy, whether it's what you're looking for longterm or not. <This other path> is probably what you're looking for right now to get things rolling."
You need to the jar itself in the classpath. Java will look for the necessary files in that jar. After the classpath, you need to specify the name of your class to run your compiled program. That is why I had "ClassYouWantToRun" in my statement above.
Need some help with this Array. I am trying to get the sum of the even numbers and the sum of the odd numbers using a for each loop. I know the answers to what I am trying to achive are sum of even = 84 and the sum of ...
I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...