We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 830f3ce commit 87e1339Copy full SHA for 87e1339
JDBCExample1.java
@@ -0,0 +1,21 @@
1
+// Demonstarting Select Database
2
+import java.sql.Connection;
3
+import java.sql.DriverManager;
4
+import java.sql.SQLException;
5
+import java.sql.Statement;
6
+
7
+public class JDBCExample1 {
8
+ static final String DB_URL = "jdbc:mysql://localhost/TUTORIALSPOINT";
9
+ static final String USER = "guest";
10
+ static final String PASS = "guest123";
11
12
+ public static void main(String[] args) {
13
+ System.out.println("Connecting to a selected database...");
14
+ // Open a connection
15
+ try(Connection conn = DriverManager.getConnection(DB_URL, USER, PASS);) {
16
+ System.out.println("Connected database successfully...");
17
+ } catch (SQLException e) {
18
+ e.printStackTrace();
19
+ }
20
21
+}
0 commit comments