Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Connect to the database without port?

derokDec 9 2010 — edited Dec 10 2010
Hi,
i recently created a thread explaining a problem with a connection to a sql database and a port, located here:
2144137

im still trying to resolve that,

this is the code i have:
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
String url = "jdbc:sqlserver://localhost:1433;databaseName=Factura";
Connection conn = DriverManager.getConnection(url,"sa","");
but i have a question:

can i connect to the database without specifying the port?

i mean, im also connecting to that database with another programming language, and im not specifying a port in that language and the connection is working correctly.

can you also connect to a database in java without the need of a port?

how can i do that?

thanks..

Edited by: derok on Dec 9, 2010 3:30 PM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 7 2011
Added on Dec 9 2010
5 comments
890 views