-
Java and SQL Server
Hi all !
Sorry for elementary question. I don't waste your time much. Please, explain me how is doing connection between SQL Server Database and java?
I read more and watch tutorials about that, but I don't understand the principe of writing url address of database. For example, if I have database in my computer, with what address I can connect it?
For example, this is url connection address
url ="jdbc:sqlserver://localhost:1433"
I don't understand this...
Thanks in advance.
-
Re: Java and SQL Server
Moved from New to Java
db
-
Re: Java and SQL Server
Each JDBC driver has a different URL signature for connecting to a database.
The one you have there is the standard jdbc:sqlserver one.
That's what the first part says.
If you were using the JTDS driver it would say jdbc:jtds:sqlserver.
This allows JDBC to find the correct driver to use.
The second half is just the location of the port on which the server is listening for connections.
-
Re: Java and SQL Server
OK, thanks so much for your explanation !
Please, tell me, can I be connected to Northwind pubs SQL examples? If yes, how is it possible?
-
Re: Java and SQL Server
Have that on your SQL Server and then look up the URL you need (probably the one above).
Google for SQL Server JDBC and read up on MSDN about what the options are on the connection string. There is one to specify which database instance you want to be connected to (in your case whatever the Northwinds db is called).
-
Re: Java and SQL Server
As I understood each database has its own url, which I can get above of window?
-
Re: Java and SQL Server
The MSDN articles will explain what you need to do.
I never bother remebering these things as I work on different DBs every few months, so I'd have to look it up.
-
Re: Java and SQL Server