1 Comment

Java Database Connection Strings

Java Database Connection

JDBC is a Java-based data access technology (Java Standard Edition platform) from Sun Microsystems. It is an acronym as it is unofficially referred to as Java Database Connectivity, with DB being universally recognized as the abbreviation for database. This technology is an API for the Java programming language that defines how a client may access a database. It provides methods for querying and updating data in a database. JDBC is oriented towards relational databases. A JDBC-to-ODBC bridge enables connections to any ODBC-accessible data source in the JVM host environment.

The method Class.forName(String) is used to load the JDBC driver class. The line below causes the JDBC driver from some jdbc vendor to be loaded into the application.

(Source: Wikipedia)
Class.forName("Driver name");
Connection con = DriverManager.getConnenction("jdbcurl","username","password");

Connection URL & Drivers List

IBM DB2
jdbc:db2://<HOST>:<PORT>/<DB>
COM.ibm.db2.jdbc.app.DB2Driver

JDBC-ODBC Bridge
jdbc:odbc:<DB>
sun.jdbc.odbc.JdbcOdbcDriver

Microsoft SQL Server
jdbc:weblogic:mssqlserver4:<DB>@<HOST>:<PORT>
weblogic.jdbc.mssqlserver4.Driver

Oracle Thin
jdbc:oracle:thin:@<HOST>:<PORT>:<SID>
oracle.jdbc.driver.OracleDriver

PointBase Embedded Server
jdbc:pointbase://embedded[:<PORT>]/<DB>
com.pointbase.jdbc.jdbcUniversalDriver

Cloudscape
jdbc:cloudscape:<DB>
COM.cloudscape.core.JDBCDriver

Cloudscape RMI
jdbc:rmi://<HOST>:<PORT>/jdbc:cloudscape:<DB>
RmiJdbc.RJDriver

Firebird (JCA/JDBC Driver)
jdbc:firebirdsql:[//<HOST>[:<PORT>]/]<DB>
org.firebirdsql.jdbc.FBDriver

IDS Server
jdbc:ids://<HOST>:<PORT>/conn?dsn='<ODBC_DSN_NAME>'
ids.sql.IDSDriver

Informix Dynamic Server
jdbc:informix-sqli://<HOST>:<PORT>/<DB>:INFORMIXSERVER=<SERVER_NAME>
com.informix.jdbc.IfxDriver

InstantDB (v3.13 and earlier)
jdbc:idb:<DB>
jdbc.idbDriver

InstantDB (v3.14 and later)
jdbc:idb:<DB>
org.enhydra.instantdb.jdbc.idbDriver

Interbase (InterClient Driver)
jdbc:interbase://<HOST>/<DB>
interbase.interclient.Driver

Hypersonic SQL (v1.2 and earlier)
jdbc:HypersonicSQL:<DB>
hSql.hDriver

Hypersonic SQL (v1.3 and later)
jdbc:HypersonicSQL:<DB>
org.hsql.jdbcDriver

Microsoft SQL Server (JTurbo Driver)
jdbc:JTurbo://<HOST>:<PORT>/<DB>
com.ashna.jturbo.driver.Driver

Microsoft SQL Server (Sprinta Driver)
jdbc:inetdae:<HOST>:<PORT>?database=<DB>
com.inet.tds.TdsDriver

Microsoft SQL Server 2000 (Microsoft Driver)
jdbc:microsoft:sqlserver://<HOST>:<PORT>[;DatabaseName=<DB>]
com.microsoft.jdbc.sqlserver.SQLServerDriver

MySQL (MM.MySQL Driver)
jdbc:mysql://<HOST>:<PORT>/<DB>
org.gjt.mm.mysql.Driver

Oracle OCI 8i
jdbc:oracle:oci8:@<SID>
oracle.jdbc.driver.OracleDriver

Oracle OCI 9i
jdbc:oracle:oci:@<SID>
oracle.jdbc.driver.OracleDriver

PostgreSQL (v6.5 and earlier)
jdbc:postgresql://<HOST>:<PORT>/<DB>
postgresql.Driver

PostgreSQL (v7.0 and later)
jdbc:postgresql://<HOST>:<PORT>/<DB>
org.postgresql.Driver

Sybase (jConnect 4.2 and earlier)
jdbc:sybase:Tds:<HOST>:<PORT>
com.sybase.jdbc.SybDriver

Sybase (jConnect 5.2)
jdbc:sybase:Tds:<HOST>:<PORT>
com.sybase.jdbc2.jdbc.SybDriver

SqliteDB
jdbc:sqlite://<FileName>
org.sqlite.JDBC
Leave a comment

JeazyProps (Revisited)

As we Discussed Earlier in the Following Post

https://prabhuprabhakaran.wordpress.com/2012/09/09/jeazyprops/

An Overview

JeazyProps is a java framework, that used to load the properties dynamically into a POJO. It Automatically draws the GUI to save the properties to the file, either as XML or as .properties file. It reduces the effort for loading the properties from file, assigning to the bean and writing the properties to the file.

Features

  1. Reduces complexity and LOC of codes to load number of properties.
  2. Supports various data types such as String, Boolean, Integer and Double.
  3. Supports Encryption such as Base64, TripleDes and AES by default.
  4. Supports both XML and .properties file.
  5. Supports both class path file and external file.
  6. Supports different GUI components dynamically as per the data type.
  7. Supports Validation of data.
  8. Supports user defined Encryption Algorithms.
  9. Zero lines code to Update and Save the properties on run time.
  10. Well Designed and completely documented using javadoc.
  11. Additional functionality of displaying properties in command window

Added Features

  1. Supports property file packed inside the jar to read.
  2. On saving, Overrides the property inside jar by using an classpath property file.
  3. File and Path selection option using filechooser With validation.
  4. Integrable with the main application, and display as separate window.
  5. Dual Mode Display (Read Mode and Read-Write Mode)
  6. Supports the main application’s Look and feel.

Snapshots

This slideshow requires JavaScript.

1 Comment

MVC architecture – A OverView

Software development is always subject to change, especially change the interface of the application code because the interface is the part that interacts directly with the user, and that is the fundamental to the user for ease of use applications. With the changes, it will display the potential for a change also in the other and it will make the system more complex and complicated. To solve the problem, Introduce an architecture or pattern called Model View Controller (MVC).

Model View Controller (MVC) is a pattern that can build more effective software project because it is done by sorting the components between the Model, View and Controller. By implementing MVC in building an application will impact on the ease of the application when the maintenance phase. Process development and integration became easier to do. The basic idea of ​​MVC is actually very simple, which is trying to separate the model, view, and controller.

Image

There are three main layers in the MVC architecture, which is referred to as bestpractices namely:

1.Model

The model here serves as a representation of the data involved in the transaction process. Each time the method / function of an application need to make access to the data, then the function / method is not directly berinteaksi the data source but through the model first. In this case only the models that are allowed to interact directly with the source data.Secara short, this model layer handles the content of the application. The advantage with the model are:

a. The process of application maintenance

Placement details of data and operations in a given area so as not spread to the entire scope of the application.

b. Reusable Model

Reuse of application of the model by other applications due to the separation of the data interface.

2. View

View here acts as a presentation layer or controller user interface (view) for the user of an application. The data required by the user to be formatted in such a way that they can perform and be presented with a display format that is tailored to the user’s requirements. Layer so that it does not matter what the content was. For example, for Application Discount, this layer decides whether the shopping list will be displayed in a table, displayed to the command prompt, are presented in tables Swing, or exported to a text file. In addition, usually the layer view also served to validate the data entered by users. Excess of view are:

Facilitate the incorporation of design in the development team.
Availability of multiple interfaces in applications.

3. Controller

Controller here act as logic aspect of the application / user set flow. Controller will determine the bussiness process of the applications built. Controller will respond to any input from the user by calling the appropriate model and the view that the request / demand of the user can be fulfilled. Usually the controller layer is also used to set the access permissions and permissions. The advantages of the Controller are:

Component view can be designed without having to pay attention to other parts of the excess.
Clear separation between presentation logic and business logic.

Although many advantages of being owned by the MVC, but there are still a lot of side effects produced. These side effects are an increase in applications complexity so small that does not require loose coupling on the block barrier model in MVC pattern itself.

Leave a comment

Java Programming and its features

Originally posted on christyarnott15:

Introduction of Java Programming

Java programming is in fact a computer language constructed by James Gosling belonging to Sun Microsystems and was presented on the seen in the year 1995. First version of Java was Java 1.0 and it was published and presented to public in the year 1995. As the time progressed on, new versions of Java was being presented to the betterment of people belonging to computer field, till now 7 versions have been presented and current version is 1.7 which is also called as Java 7. With the introduction of Java programming, Java platform came in to being and it provides and opportunity that you can write you programming code even in any other language except Java language but it will still be available in Java virtual machine.

Basics of Java Programming

If you have experience of using other programming languages than Java programming and are familiar…

View original 484 more words

Leave a comment

The FIVE qualities you MUST have to achieve your goals!

The FIVE qualities you MUST have to achieve your goals!

“A little knowledge that acts is worth infinitely more
than much knowledge that is idle.” – Kahlil Gibran, writer.

MOTIVATION

You must have the force which drives you to take action. The force and the action are inseparable: motivation does not exist without there being action, else all you are left with is no change and no progress. Conversely to what you might expect, the first step to generating motivation is to take action. Where you might expect to require motivation before you take action, by inverting it, and actually taking action first, it then builds your level of motivation.

COMMITMENT

The difference between involved and committed is like the difference between eggs and bacon. The chicken was involved. The pig was committed. This little joke illustrates the nature of commitment. To be truly committed means giving your heart and soul to completing your objective, and really caring about the outcome. It means having the resolve and will to create the outcome you desire, regardless of the amount of energy it will require to achieve.

DETERMINATION

Determination is the quality of resoluteness to achieving your objectives. To be determined means that you have decided to achieve your aim, and will not waver until you have achieved your goal. I want a trimmer body, but I have not been exercising yet – why? Because I have not decided to do what it takes to achieve that aim – i.e. I am not determined enough yet.

PERSISTENCE

Persistence is the quality of remaining resolute to your goals while you are in the process of trying to realise them. It is the quality that prevents you giving up when obstacles get in the way of your progress. Being persistent means being flexible, and committed to finding the solutions to problems that would otherwise stop you from reaching your goal. Being persistent means spending two years knocking on 1,009 doors with your recipe for fried chicken like Colonel Sanders did!

DISCIPLINE

Discipline is the quality of self-mastery that allows you to make progress on your goal when your “dark side” tempts you to behaviour that is a movement away from reaching your goal. It is discipline that allows you to forsake short-term pleasures or gains, in favour of your longer-term objectives. Again, having discipline is a choice which you exercise by choosing to accept the responsibility for all your behaviours, and then choosing the behaviour which aligns with your overall objective.

Leave a comment

4 Comments

JeazyProps

JeazyProps is a java framework, that used to load the properties dynamically into a POJO.

Properties is a subclass of Hashtable. It is used to maintain lists of values in which the key is a String and the value is also a String. The Properties class is used by many other Java classes. For example, it is the type of object returned by System.getProperties() when obtaining environmental values.

To load an external resource in Java, several options immediately come to mind: files, classpath resources, and URLs.

  • load()- This method reads a property list (key and element pairs) from the input stream.
  • getProperty() – This method searches for the property with the specified key in the properties file.
  • store() – This methods writes the properties list to the output steam.

Here i have listed some classic example for loading and saving the properties by using java.

By using these snippets we can able to load manually, i.e, the mapping of the properties to the POJO bean should always code by us. There should be no option to change the properties using any GUI. If we want a UI then we have to build that separately to change the properties.

But in case of JeazyProps, It Automatically draws the GUI to save the properties to the file, either as XML or as .properties file. It reduces the effort for loading the properties from file, assigning to the bean and writing the properties to the file.

Features

  1. Reduces complexity and LOC of codes to load number of properties.
  2. Supports various data types such as String, Boolean, Integer and Double.
  3. Supports Encryption such as Base64, TripleDes and AES by default.
  4. Supports both XML and .properties file.
  5. Supports both class path file and external file.
  6. Supports different GUI components dynamically as per the data type.
  7. Supports Validation of data.
  8. Supports user defined Encryption Algorithms.
  9. Zero lines code to Update and Save the properties on run time.
  10. Well Designed and completely documented using javadoc.
  11. Additional functionality of displaying properties in command window.

Steps to use JeazyPorps

1. Download the JeazyProps jar and Java-doc from the Website

http://java.net/projects/jeazyprops/downloads

2. Add the jar to the project.
In Netbeans, Right click on Libraries and click Add Jar/Folder.
Browse and add the jar to the Project.

3. Create Empty pojo class. Create getter and setter for your properties.

4. Create objects for keyvalue class as exact name as pojo member variable with initcaps.

The POJO/Bean is created as the below…

we may add a singleton wrapper also with the class as below

we may simply use the properties in the Application as
PropsTestGUI.getInstance().getProperty1();

We may configure the properties using the GUI,
the GUI invoked by calling the function
PropsTestGUI.getInstance().displayProperties();

This slideshow requires JavaScript.

Follow

Get every new post delivered to your Inbox.

Join 277 other followers