This Java example finds all the tables and their corresponding columns from a database. The code iterates over the entities and columns found and shows them on the console.
Minor changes are necessary to process the found values in a different way.
Connection conn; DatabaseMetaData dmd; ResultSet rs1, rs2; ResultSetMetaData rsmd; Statement s; try { conn = getConnection(); dmd = conn.getMetaData(); rs1 = dmd.getTables("database_name", null, "%", null); s = conn.createStatement(); while (rs1.
Netbeans is one of my beloved day to day applications. Yesterday, when I installed Ubuntu 15.10 (Wily Werewolf) on my computer, Netbeans started to hang on the startup screen, specifically at the Loading Modules phase. It took me hours looking for solutions on the internet; and reinstalling different versions of the Java Development Framework didn’t seem to help.
Finally I found the following fix at an Ubuntu forum, which turned out to be very simple to apply.
Important: This is a work in progress document.
The Model-View-Controller is a software pattern frequently used for web development. As its name states, it is composed by three components:
A Model or domain representation of a problem. It receives commands, processes them and modifies its state according to the input provided. A View whose main task is to retrieve information from the model and turn it into a useful representation for the user.
This time we are going to create a basic connection to MySQL in Java and pull some data from it.
// Compile it: // javac Mysql.java // // Try it: // java -classpath mysql-connector-java-5.1.27-bin.jar:. MySQL import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.Properties; public class MySQL { public Connection getConnection() throws SQLException { Connection conn = null; Properties p = new Properties(); p.put("user", "username"); p.put("password", "superpassword"); String cs = "jdbc:mysql://localhost/demo"; conn = DriverManager.
This time we are going to install Solr, the super text search platform on CentOS. The installation process requires a couple extra libraries in order to work: Apache Commons Logging and SLF4J. Installing Java yum install java java -version You must have at least version 1.6 in order to run Solr. If you got Java 1.5, I recommend you to follow this tutorial to get version 1.6.
Installing Tomcat yum -y install tomcat6 tomcat6-webapps tomcat6-admin-webapps chkconfig tomcat6 on service tomcat6 start Use a web browser to check it is working correctly.
Java 1.5 is the default Java version you get when you ask yum to install it on CentOS. However, several applications need 1.6 in order to run. Just follow the next steps to install it.
Remove Java 1.5
yum remove java-1.5-* Install the rpmforge repository
cd rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt Check if you have a 32 or 64 CentOS version
uname -a For 32 versions (i686) download and install the following repository
From time to time we all have needed to show a YouTube video where no Internet connection is available.
This program will allow you to download a video from YouTube for later playback. It is important to say that YouTube constantly changes its video URL, so someday it may need some rework. The following code was tested on Aug 12, 2012 and it works.
Have a good day.
/** * YouTubeDownloader * * Modified by Andres Jaimes https://andres.
Java, the programming language for many of us, is shinning more than ever! Just see how Android (Google’s operating system) uses it for its applications:
http://en.wikipedia.org/wiki/Android_%28operating_system%29
Running multiple versions of the .NET framework in IIS When you install a new .NET framework in your IIS server some applications can stop working showing you the following error:
Server Application Unavailable In the event viewer you will find this:
the same IIS process. Please use the IIS Administration Tool to reconfigure your server to run the application in a separate process. This happens because different .NET frameworks can run in the same server, but cannot share the same application pool, so, to solve this:
I have always considered myself a C++ guy. That was one of the first languages I learned. But, life has taken me through many different paths, and I have needed to learn others. It was seven years ago, when I tried my first cup of Java and I realized objects were a must: Why did I need to create an additional class to return a compound value? another file?, I could do a “one-liner” in C++.