File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Properties for getConnection? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Properties for getConnection?" Watch "Properties for getConnection?" New topic

Properties for getConnection?

Tina Coleman
Ranch Hand

Joined: Dec 12, 2001
Posts: 150
The documentation for java.sql.DriverManager (1.3) says that the getConnection() method has a signature that takes Properties. What I haven't found yet is any documentation that says what could be contained in that Properties set. (It lists it as an 'arbitrary set of string/value pairs.) Should I assume that that should be part of my driver's documentation? I'm looking for it for the MS SQL Server 2000 JDBC driver, but haven't yet found it.
Axel Janssen
Ranch Hand

Joined: Jan 08, 2001
Posts: 2164
Hi Tina,
I used it and for my understanding its just overloaded from the

Properties is just a java.util.* class, which overwrites Hashtable --->
I can't imagine a situation where you won't put two Strings in it to establish the database-connection.
[ January 17, 2002: Message edited by: Axel Janssen ]
Tina Coleman
Ranch Hand

Joined: Dec 12, 2001
Posts: 150
I did end up finding my answer. . . Essentially, I had run across something that suggested I needed to pass in a property other than username or password (property was SelectMode for the SQL Server 2000 database), but I was having difficulty finding documentation for that property.
I'm using a connection pooling mechanism provided by some in-house libraries, so haven't had to deal with things in as-detailed a manner as I might have had to otherwise. Under the covers, the connections added to the connection pool are created by setting the username and password as part of the Properties parameter. I ended up passing in my SelectMode property as part of the URL string for the connection. (Documentation for that property did exist in a different MS JDBC 2000 document - I just was looking in the wrong place.)
I agree. Here's the link:
subject: Properties for getConnection?
jQuery in Action, 3rd edition