azure / azure-sql-database-samples Goto Github PK
View Code? Open in Web Editor NEWAzure SQL Database Samples and Reference Implementation Repository
License: Other
Azure SQL Database Samples and Reference Implementation Repository
License: Other
Code at : https://docs.microsoft.com/nl-nl/azure/sql-database/sql-database-connect-query-java
Code I saw at 25-01-2018
public static void main(String[] args) {
// Connect to database
String hostName = "your_server.database.windows.net";
String dbName = "your_database";
String user = "your_username";
String password = "your_password";
String url = String.format("jdbc:sqlserver://%s:1433;database=%s;user=%s;password=%s;encrypt=true;hostNameInCertificate=*.database.windows.net;loginTimeout=30;", hostName, dbName, user, password);
Connection connection = null;
try {
connection = DriverManager.getConnection(url);
String schema = connection.getSchema();
System.out.println("Successful connection - Schema: " + schema);
System.out.println("Query data example:");
System.out.println("=========================================");
// Create and execute a SELECT SQL statement.
String selectSql = "SELECT TOP 20 pc.Name as CategoryName, p.name as ProductName "
+ "FROM [SalesLT].[ProductCategory] pc "
+ "JOIN [SalesLT].[Product] p ON pc.productcategoryid = p.productcategoryid";
try (Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(selectSql)) {
// Print results from select statement
System.out.println("Top 20 categories:");
while (resultSet.next())
{
System.out.println(resultSet.getString(1) + " "
+ resultSet.getString(2));
}
connection.close();
}
}
catch (Exception e) {
e.printStackTrace();
}
}
}
There is currently duplicate code, for instance in the python example, which is exactly the same on both platforms and the only difference is the installation instructions on each platform.
Ideally these would be collapsed and you could just have different sections for each platform, as currently the structure of the project makes it appear like you will need to write different code on different platforms, when that isn't true.
Hi, error occurred on connecting to MSSQL2017 Linux edition, it shows SQL Server v15 is not supported. May I know is it really not supported yet? thankyou
I'm trying to configure my Rails project with SQL on Azure. I'm using Mac OS X 10.11. But when I run rake db:migrate
I receive this error TinyTds::Error: Adaptive Server connection failed.
I'm looking for answer in Stackoverflow, too.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.