How To Check Sql Server Jdbc Driver Version In Windows
Microsoft SQL Server JDBC for Windows
This tutorial shows how to fix a data source and connect to your Microsoft® SQL Server® database. This tutorial uses the Microsoft JDBC Driver four.0 for Microsoft SQL Server to connect to the Microsoft SQL Server 2012 Express database.
-
Step 1. Verify the driver installation.
-
Step 2. Verify the port number.
-
Step 3. Prepare the operating organisation authentication.
-
Stride four. Add together the JDBC driver to the MATLAB static Java class path.
-
Step 5. Set the data source using Database Explorer.
-
Step vi. Connect using Database Explorer or the command line.
Step 1. Verify the driver installation.
If the JDBC driver for Microsoft SQL Server is not installed on your computer, find the link on the Driver Installation page to install the driver. Follow the instructions to download and install this commuter on your computer.
Step 2. Verify the port number.
To connect to your database using a JDBC commuter, you must know the port number. Use the following steps on the machine where Microsoft SQL Server is installed to find your port number. If you experience connexion bug with the port number that you observe, contact your database administrator.
-
On the machine where your Microsoft SQL Server database is installed, click Start. Select your Microsoft SQL Server version folder and click Configuration Tools. Then click SQL Server Configuration Manager.
-
In the Sql Server Configuration Managing director window, click SQL Server Network Configuration on the left side. Double-click Protocols for SQLEXPRESS.
-
See if TCP/IP is enabled. If and so, skip the steps for enabling TCP/IP and restarting the server.
-
If TCP/IP is disabled, right-click TCP/IP and select Enable.
-
To finish the process of enabling the TCP/IP protocol, restart the server. Click SQL Server Services on the left side of the window. Right-click SQL Server (SQLEXPRESS) and click Restart.
-
The server restarts enabling TCP/IP. Click Protocols for SQLEXPRESS and correct-click TCP/IP. Select Backdrop.
-
In the TCP/IP Properties dialog box, roll to the bottom in the IP Addresses tab until you lot see IP All grouping. The number adjacent to the TCP Dynamic Ports field is the port number. Use this port number in the JDBC connection parameters for Database Explorer or the command line. Here, the port number is
53917
. If this number is0
or you want to configure your Microsoft SQL Server database server to listen to a specific port, delete the entry in the TCP Dynamic Ports field and enter another port number in the TCP Port field.
Step 3. Fix the operating system authentication.
Windows® authentication lets you to connect to your database using your Windows user account. In this example, Windows performs user validation and the database does not require a unlike user name and password. Windows authentication facilitates easy maintenance of database access credentials. After you add the required libraries to the system path, the Microsoft SQL Server JDBC driver allows connectivity using Windows authentication. The following steps evidence how to add these libraries to the Java® library path in MATLAB®. For details about Coffee libraries, see Bring Java Classes into MATLAB Workspace.
-
Ensure that you have the latest Java commuter library installed on your computer. To install the latest library, see Driver Installation.
-
Run the
prefdir
command in the Control Window. The output of this command is a file path to a folder on your estimator. -
Close MATLAB if it is running.
-
Navigate to the folder and create a file called
javalibrarypath.txt
in the folder. -
Open
javalibrarypath.txt
and insert the path to the Java library filesqljdbc_auth.dll
. Use the x64 folder. In the entry, include the full path to the library file. Do not include the library file proper noun. For example,C:\DB_Drivers\sqljdbc_4.0\enu\auth\x64
.The
sqljdbc_auth.dll
file is installed in the post-obit location:<installation>\sqljdbc_<version>\<language>\auth\<curvation>
<installation>
is the installation binder of the Microsoft SQL Server JDBC driver,<version>
is the JDBC driver version,<linguistic communication>
is the JDBC driver language, and<curvation>
is the compages. -
Open MATLAB.
Step four. Add the JDBC driver to the MATLAB static Java class path.
-
Run the
prefdir
control in the Control Window. The output is a file path to a binder on your computer. -
Close MATLAB if it is running.
-
Navigate to the binder and create a file called
javaclasspath.txt
in the binder. -
Open
javaclasspath.txt
. Add the total path to the database driver JAR file injavaclasspath.txt
. The total path includes the path to the folder where yous downloaded the JAR file from the database provider and the JAR file name. For example,C:\DB_Drivers\sqljdbc_4.0\enu\sqljdbc4.jar
. Save and closejavaclasspath.txt
. -
Restart MATLAB.
Alternatively, you can use javaaddpath
to add your JDBC driver to the dynamic Coffee grade path. For details about static and dynamic class paths, see Bring Java Classes into MATLAB Workspace.
Step five. Set up the data source using Database Explorer.
This pace is required only for connecting to Database Explorer. If you lot desire to use the command line to connect to your database, come across Connect to Microsoft SQL Server using the JDBC connection command line.
-
Open Database Explorer past clicking the Apps tab on the MATLAB Toolstrip. And then, select Database Explorer from the Database Connectivity and Reporting section in the apps gallery. Alternatively, enter
dexplore
at the control line. If no data sources are set, a message box opens. Click OK to shut it. Otherwise, the Connect to a Data Source dialog box opens. Click Cancel to close this dialog box. -
Click the Database Explorer tab, and then select New > JDBC.
The Create a New JDBC information source dialog box opens.
-
Select
MICROSOFT SQL SERVER
from the Vendor list. After selecting the vendor, if you did not add the JDBC commuter file path to the Java class path, this dialog box displays this message at the bottom. Address this message past following the steps described in Footstep 4. -
Enter the database server proper noun in the Server Name field, port number in the Port Number field, user name in the Username field, password in the Password field, and database name in the Database field.
-
Create a data source without Windows authentication by setting the Hallmark Type to
Server
.Or, create a information source with Windows authentication by setting the Authentication Blazon to
Windows
and leaving Username and Password blank. -
Click Test to exam the connection. If your connexion succeeded, Database Explorer displays Connection Successful!
-
Enter a data source name in the Data Source Name field in the Create a New JDBC information source dialog box. Use a new data source proper noun that does not announced in the existing list of data source names. Click Save. The new JDBC information source appears in the list of data sources in the Connect to a Data Source dialog box.
-
If this time is the kickoff time that you lot are creating a data source using Database Explorer, the New file to store JDBC connexion parameters dialog box opens. Use this dialog box to create a MAT-file that saves your specified data source data for future Database Explorer sessions. This MAT-file proper name is stored in
setdbprefs('JDBCDataSourceFile')
and is valid for all MATLAB sessions.Navigate to the folder where you want to put the MAT-file, specify a name for it that includes a
.mat
extension, and click Salvage.Afterward you complete the data source setup, connect to the Microsoft SQL Server database using Database Explorer or the command line with the JDBC connection.
Step vi. Connect using Database Explorer or the command line.
Connect to Microsoft SQL Server using Database Explorer.
-
After setting up the information source, connect with operating arrangement authentication past selecting the data source that yous prepare up with Windows authentication from the Information Sources list. Exit the user name and password blank. Click Connect.
-
Connect to your database without operating organization hallmark by selecting the data source that you lot set upwards without Windows authentication. Enter a user name and password. Click Connect.
Database Explorer connects to your database and displays its contents in a tab named with the data source name.
-
Shut the connection using Database Explorer by hovering the cursor over the Close push button (
) next to the MS SQL Server JDBC data source proper noun on the database tab. The Close push turns into a scarlet circle (
). Click information technology to close the database connexion. If y'all desire to shut Database Explorer and all database connections, click the Close button (
) in the tiptop-right corner.
If Database Explorer is docked, click the Close push (
) to shut all database connections and Database Explorer.
Connect to Microsoft SQL Server using the JDBC connection control line.
When using the command line, you do not have to gear up a data source with Database Explorer. You lot can use the control line to pass all the required parameters for connexion.
-
To connect with operating system authentication, use the
Vendor
name-value pair statement ofdatabase
to specify a connection to a Microsoft SQL Server database. Utilize theAuthType
name-value pair argument to connect with Windows authentication. Specify a blank user proper name and password. For example, the following code assumes you are connecting to a database nameddbname
, database server namedsname
, and port number123456
.conn = database('dbname','','','Vendor','Microsoft SQL Server',... 'Server','sname','AuthType','Windows',... 'PortNumber',123456);
Or, to connect without operating system authentication, employ the
AuthType
proper name-value pair argument ofdatabase
to specify a connection to the database serverServer
. For instance, the following code assumes you are connecting to a database nameddbname
with user proper nameusername
and passwordpwd
.conn = database('dbname','username','pwd',... 'Vendor','Microsoft SQL Server','Server','sname',... 'AuthType','Server','PortNumber',123456);
-
Shut the database connection
conn
.
See Besides
shut
| database
| javaaddpath
More About
- Working with Database Explorer
- Bring Coffee Classes into MATLAB Workspace
Was this topic helpful?
Source: https://lost-contact.mit.edu/afs/inf.ed.ac.uk/group/teaching/matlab-help/Yesterday/R2016b/database/ug/microsoft-sql-server-jdbc-windows.html
Posted by: lovellgeopers.blogspot.com
0 Response to "How To Check Sql Server Jdbc Driver Version In Windows"
Post a Comment