Database Connections in Java
Before giving structures, we need to notice a little detail about making database connections in Java. All database connections must be stated in try and catch statements, because there is a possibility of getting an exception. That’s way, we try to make our connection in try statement. If our connection attempt fails, that means there is an exception, and the exceptions must be catched.
1.1) MS SQL Connection in Java
Example 1.1: MakingConnections.java
You can determine the server, uid, pwd and database variables as you need.
As you see, we wrote our createSQLConnection() function to create our database connection. You can use this function to create a Statement to manage your records like this:
Example 1.2: An addition to Example 1.1
If you don’t know how to create and use statements in Java, you have to wait a little bit for our next articles that will contain detailed information and clues about how to use statements and manage database records in Java.
Categories: Java Connections, Database, Database Connections, Java, jdbc, odbc, SQL, SQL Server, sun

Recently Typed