Firstly, the error im getting is:
[STDOUT] java.sql.SQLException: Table not found: USERS_TBL in statement [SELECT * FROM
users_tbl]
Im executing this using the code:
| try {
| Context ctx = new InitialContext();
| Object ob = ctx.lookup("java:comp/env/jdbc/MySqlDS");
| connectionPool = (DataSource) ob;
|
| conn = connectionPool.getConnection();
| Statement s = conn.createStatement();
| res = s.executeQuery("SELECT * FROM users_tbl");
|
|
| } catch (Exception e) {
| System.err.println(e.toString());
| }
|
If i use the code below everything works fine:
| try{
| Class.forName("com.mysql.jdbc.Driver");
| String url = "jdbc:mysql://localhost:3306/davidjc2_jspforums";
| conn = DriverManager.getConnection(url, "davidjc2_webuser","123qwe");
|
| Statement s = conn.createStatement();
| res = s.executeQuery("SELECT * FROM users_tbl");
|
| }catch(Exception e){
| System.err.println(e.toString());
| }
|
In ejb-jar.xml i have:
| <resource-ref>
| <description>The MySQL Database</description>
| <res-ref-name>jdbc/MySqlDS</res-ref-name>
| <res-type>javax.sql.DataSource</res-type>
| <res-auth>Container</res-auth>
| </resource-ref>
|
Which leads me to believe its something to do with my configuration.
In standardjaws.xml i have:
| <datasource>java:/MySqlDS</datasource>
| <type-mapping>mySQL</type-mapping>
|
In login-config.xml i have:
| <application-policy name = "MySqlDbRealm">
| <authentication>
| <login-module code =
| "org.jboss.resource.security.ConfiguredIdentityLoginModule"
| flag = "required">
| <module-option name ="principal">myusername</module-option>
| <module-option name ="userName">myusername</module-option>
| <module-option name ="password">mypassword</module-option>
| <module-option name ="managedConnectionFactoryName">
| jboss.jca:service=LocalTxCM,name=MySqlDS
| </module-option>
| </login-module>
| </authentication>
| </application-policy>
|
In mysql-ds.xml in deploy directory i have:
| <datasources>
| <local-tx-datasource>
| <jndi-name>jdbc/MySqlDS</jndi-name>
| <connection-url>jdbc:mysql://localhost:3306/davidjc2_jspforums</connection-url>
| <driver-class>com.mysql.jdbc.Driver</driver-class>
| <user-name>myusername</user-name>
| <password>mypassword</password>
| </local-tx-datasource>
|
| </datasources>
|
Can anyone help with this please?
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3844644#3844644
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3844644
-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user