Search
 
SCRIPT & CODE EXAMPLE
 

SQL

conectar base de datos mysql con java

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
public class SimpleTesting{
    public static void main(String[] args) {
        try
        {
            Class.forName("com.mysql.jdbc.Driver");
            Connection con=DriverManager.getConnection(
                    "jdbc:mysql://localhost:3306/delftstackDB","username","dbPassword");
            Statement stmt=con.createStatement();  
            ResultSet rs=stmt.executeQuery("show databases;");
            System.out.println("Connected");  
        }
        catch(Exception e)
        {
            System.out.println(e);
        }
    }  
}
Comment

PREVIOUS NEXT
Code Example
Sql :: opensuse status MySQL 
Sql :: decalre table in sql 
Sql :: how to connect .sql data set to powerbi 
Sql :: postgresql GRANT role_2 TO role_1 
Sql :: veri seçme SQL 
Sql :: difference between on and where in sql 
Sql :: like in openquery 
Sql :: mysql if without else 
Sql :: PL-SQL: mm-dd for subqueries and different columns 
Sql :: alter table add column integer default 0 
Sql :: many to many getting data mysql 
Sql :: sqlite display data in separated columns 
Sql :: FILENAME /usr/bin/mysql does not exists. Make sure correct path is set in /etc/dump admin/settings.conf. 
Sql :: having all mysql 
Sql :: sql query contains multiple ids 
Sql :: como hacer una consulta de un registro que no esta en una tabla en mysql 
Sql :: sql random date between two dates 
Sql :: insert into one table from another table in oracle 
Sql :: could not find driver (SQL: PRAGMA foreign_keys = ON;) larave 
Sql :: generate series sqlserver 2005 
Sql :: java nosql sort 
Sql :: trigger vérifier stock 
Sql :: difference between nvl and nvl2 in oracle 
Sql :: sql "List the contact methods found in the Contact table.For each contact method, list how many people chose that contact method." 
Sql :: mysql faster delete 
Sql :: SQL Remove Primary Key Constraint - SQL Server, Oracle 
Sql :: mysql database hyphen 
Sql :: how to check if sql query is correct online 
Sql :: flashback in bigquery 
Sql :: where to find job 0x.. in ddlevents 
ADD CONTENT
Topic
Content
Source link
Name
6+1 =