public static Connection getConnection(String url,String user,String password) throws SQLExceptionurl - a database url of the form jdbc:subprotocol:subname
我是用j2sdkee1.3.1做entity bean时候遇到的问题 Bean-Managed Persistence Examples 想连接到sql server 7.0 看release notes,有Syntax: j2eeadmin -addJdbcDatasource <jndi name> <url>Example:j2eeadmin -addJdbcDatasource jdbc/Oracle jdbc:oracle:thin@rtc:1521:acctThis command links the JNDI name of a DataSource with the URL of a database. Typically, the JNDI name is the logical name of a database. The URL specifies the actual location of a database. Neither the JNDI name nor the URL are hardcoded in the source code of an enterprise bean. To determine the format of the URL, please check the documentation provided by the vendor of the JDBC driver.所以才有提问,
我是用j2sdkee1.3.1做entity bean时候遇到的问题 Bean-Managed Persistence Examples 想连接到sql server 7.0 看release notes,有Syntax: j2eeadmin -addJdbcDatasource <jndi name> <url>Example:j2eeadmin -addJdbcDatasource jdbc/Oracle jdbc:oracle:thin@rtc:1521:acctThis command links the JNDI name of a DataSource with the URL of a database. Typically, the JNDI name is the logical name of a database. The URL specifies the actual location of a database. Neither the JNDI name nor the URL are hardcoded in the source code of an enterprise bean. To determine the format of the URL, please check the documentation provided by the vendor of the JDBC driver.所以才有提问,
以上的回复好象都不行
微软的说明中有
jdbc:microsoft:sqlserver://hostname:port[;property=value...]
其中的property包括 user,password,databasename,
为什么不可以呢?
微软的jdbc说明中有
jdbc:microsoft:sqlserver://hostname:port[;property=value...]
其中的property包含 user,password,和Database
我是在设置j2ee的时候感到不知如何是好
1。j2eeadmin -addJdbcDriver com.microsoft.jdbc.sqlserver.SQLServerDriver2。j2eeadmin -addJdbcDatasource <jndi name> <url>
其中2的url应该是连接到具体的数据库的一个串吧?
Bean-Managed Persistence Examples
想连接到sql server 7.0
看release notes,有Syntax:
j2eeadmin -addJdbcDatasource <jndi name> <url>Example:j2eeadmin -addJdbcDatasource jdbc/Oracle
jdbc:oracle:thin@rtc:1521:acctThis command links the JNDI name of a DataSource with the URL of a database. Typically, the JNDI name is the logical name of a database. The URL specifies the actual location of a database. Neither the JNDI name nor the URL are hardcoded in the source code of an enterprise bean. To determine the format of the URL, please check the documentation provided by the vendor of the JDBC driver.所以才有提问,
Bean-Managed Persistence Examples
想连接到sql server 7.0
看release notes,有Syntax:
j2eeadmin -addJdbcDatasource <jndi name> <url>Example:j2eeadmin -addJdbcDatasource jdbc/Oracle
jdbc:oracle:thin@rtc:1521:acctThis command links the JNDI name of a DataSource with the URL of a database. Typically, the JNDI name is the logical name of a database. The URL specifies the actual location of a database. Neither the JNDI name nor the URL are hardcoded in the source code of an enterprise bean. To determine the format of the URL, please check the documentation provided by the vendor of the JDBC driver.所以才有提问,
在j2ee中对数据库的连接不是通过DriverManager来驱动连接数据库。
用的是DataSource和JNDI。
具体的操作你可以查。
在你安装的j2ee目录下有doc目录,那里有html文档可以查看。
你也可以打开config目录下的resource.properties文件,那里有对JDBC的cloudscape,DB2,oracle的配置信息。
jdbc:microsoft:sqlserver://localhost:1433;ejbejb为你的数据库名