Overview | Package | Class | Tree | Deprecated | Index | Help | |||
PREV CLASS | NEXT CLASS | FRAMES | NO FRAMES | ||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.imaginary.sql.msql.MsqlDataSource
Context ctx = new InitialContext(); DataSource ds = (DataSource)ctx.lookup("jdbc/Wibbles"); Connection conn = ds.getConnection("borg", "");You must specify the following attributes in your JNDI directory:
databaseName
encoding
loginTimeout
password
port
serverName
user
Constructor Summary | |
MsqlDataSource()
Constructs a new MsqlDataSource without any values. |
Method Summary | |
java.sql.Connection | getConnection()
Creates an mSQL connection using the configured user name and password for the JNDI directory entry. |
java.sql.Connection | getConnection(java.lang.String uid,
java.lang.String pw)
Provides a database connection using a user and password not configured in the JNDI directory. |
java.sql.Connection | getConnection(java.util.Properties props)
Creates a connection using the specified properties. |
java.lang.String | getDatabaseName()
|
java.lang.String | getEncoding()
|
int | getLoginTimeout()
This feature is not implemented. |
java.io.PrintWriter | getLogWriter()
|
int | getPort()
|
javax.naming.Reference | getReference()
Required method to support this class as a Referenceable . |
java.lang.String | getServerName()
|
java.lang.String | getURL()
The JDBC URL that would be used to create the same sort of connection used by this data source. |
java.lang.String | getUser()
|
void | setDatabaseName(java.lang.String nom)
Sets the database name. |
void | setEncoding(java.lang.String enc)
Sets the encoding to use for this connection. |
void | setLoginTimeout(int seconds)
This feature is not yet implemented. |
void | setLogWriter(java.io.PrintWriter out)
Sets the log writer for this data source. |
void | setPassword(java.lang.String pass)
Sets the password to use for connecting to the database |
void | setPort(int p)
Sets the database port. |
void | setServerName(java.lang.String nom)
Sets the server name. |
void | setUser(java.lang.String uid)
Sets the user ID. |
Methods inherited from class java.lang.Object | |
clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait |
Constructor Detail |
public MsqlDataSource()
MsqlDataSource
without any values. It
is also used by serialization.Method Detail |
public java.sql.Connection getConnection() throws java.sql.SQLException
public java.sql.Connection getConnection(java.lang.String uid, java.lang.String pw) throws java.sql.SQLException
uid
- the user ID to connect with
pw
- the password to use for the connectionprotected java.sql.Connection getConnection(java.util.Properties props) throws java.sql.SQLException
props
- the properties to use for the connectionpublic java.lang.String getDatabaseName()
public java.lang.String getEncoding()
public java.io.PrintWriter getLogWriter() throws java.sql.SQLException
public int getLoginTimeout() throws java.sql.SQLException
public int getPort()
public javax.naming.Reference getReference() throws javax.naming.NamingException
Referenceable
.public java.lang.String getServerName()
public java.lang.String getURL()
public java.lang.String getUser()
public void setDatabaseName(java.lang.String nom)
nom
- the name of the databasepublic void setEncoding(java.lang.String enc)
enc
- the encodingpublic void setLogWriter(java.io.PrintWriter out) throws java.sql.SQLException
out
- the new log writerpublic void setLoginTimeout(int seconds) throws java.sql.SQLException
seconds
- ignore thispublic void setPassword(java.lang.String pass)
pass
- the passwordpublic void setPort(int p)
p
- the portpublic void setServerName(java.lang.String nom)
nom
- the server namepublic void setUser(java.lang.String uid)
uid
- the user IDOverview | Package | Class | Tree | Deprecated | Index | Help | |||
PREV CLASS | NEXT CLASS | FRAMES | NO FRAMES | ||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |