This is what I just made out of a query for SQL Server, you may experience something
Source: Internet
Author: User
<title>jdbc test</title>
<body>
<%@ page contenttype= "text/html;charset=gb2312"%>
<%@ page import = "Java.net.URL"%>
<%@ page import = "java.sql.*"%>
<%
String url = "Jdbc:odbc:admin";
Class.forName ("Sun.jdbc.odbc.JdbcOdbcDriver"); Load JDBC-ODBC Bridge Driver
Drivermanager.setlogstream (System.out);
Connection con = drivermanager.getconnection (URL, "sa", "super"); An attempt was made to connect to a driver.
Each registered driver will be loaded until a driver is found that can handle this URL
DatabaseMetaData DMA = Con.getmetadata (); Get the DatabaseMetaData object and display some information about the connection
Out.print ("Connected to" + Dma.geturl ());
System.out.println ("Driver" +dma.getdrivername ());
System.out.println ("Version" +dma.getdriverversion ());
System.out.println ("");
Statement stmt = Con.createstatement (); Create a Statement object that allows us to submit SQL statements to the driver
String query = "SELECT * from Information";
ResultSet rs = stmt.executequery (query); Submit query, create ResultSet object
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service