Re: R: frustrated - jdbc: No suitable driver
Thanks for the reply. That is exactly how I am initializing the context in my client application: Hashtable ht = new Hashtable(); ht.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.ApplicationClientInitialContextFactory"); ht.put(Context.PROVIDER_URL, "ormi://192.168.1.3"); ht.put(Context.SECURITY_PRINCIPAL, "someUser"); ht.put(Context.SECURITY_CREDENTIALS, "secret"); // Obtain connection InitialContext ctx = new InitialContext(ht); DeVincentiis Giustino wrote: Try initializing the context this way: ... Properties props = new Properties(); props.setProperty("java.naming.factory.initial","com.evermind.server.Applica tionClientInitialContextFactory"); props.setProperty("java.naming.provider.url", "ormi://localhost/app-name"); props.setProperty("java.naming.security.principal", "admin"); props.setProperty("java.naming.security.credentials", "123"); InitialContext ctx = new InitialContext(props); ... Giustino De Vincentiis -Messaggio originale- Da: Tom Mitchell [mailto:[EMAIL PROTECTED]] Inviato: marted 30 gennaio 2001 1.23 A: Orion-Interest Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] Oggetto: frustrated - jdbc: No suitable driver Hi All, I am used to WebLogic, so please pardon my ignorance... I am trying to get my WebLogic application to run on Orion. I have a DataSource set up to PostgreSql. It seems OK because this Orion JSP works fine: InitialContext ctx = new InitialContext(); out.print("brContext: " + ctx); DataSource ds = (DataSource) ctx.lookup("jdbc/DefaultDS"); Connection conn = ds.getConnection(); // Create query and get results Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery("select count(*) FROM weathersnapshots"); // List results while ( rs.next() ) { out.println( "br" + rs.getObject(1) + "br"); } // Close connection - important! conn.close(); This runs fine and gives me the count of rows in the table. When I try to get the standalone client to the same DataSource to run, I get this: Context: javax.naming.InitialContext@316e52 Exception in thread "main" java.sql.SQLException: No suitable driver at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at com.evermind.sql.DriverManagerDataSource.getConnection(JAX) at Test.main(Test.java:18) No errors appear on the server's console. I can not imagine why I would want to have a DB driver's jar in my client's classpath (ALTHOUGH I HAVE TRIED THAT). I have an application-client.xml: application-client /application-client I have scoured the list archives and can not find the solution. Remember, within the container, it runs fine. It is the standalone app that does not work. Using: Orion 1.4.5 JDK 1.3 Win2K Thanks in advance. -- Tom Mitchell [EMAIL PROTECTED] Very Current Stoneham, MA Weather http://www.tom.org -- Tom Mitchell [EMAIL PROTECTED] Very Current Stoneham, MA Weather http://www.tom.org
Re: R: R: frustrated - jdbc: No suitable driver
Jeff, I disagree. Part of the benefit of a DataSource is that it can abstract the actual driver or database being used. If I can ask a DataSource for a database connection and not have to care about which client-side driver to load, and (less practically), even what rdbms i am using. That way, the app server can change databases, drivers, even vendors without its clients being aware. I experienced this issue porting an app from WebLogic. I used the same schema and sql with SQL Server and Postgres on WebLogic. My client application (which both queried and populated the database) never changed. It just got a Context from the app server, gfot a DataSource by name, then got plain old JDBC Connections from there. No JDBC drivers at all. I think that is a useful layer. PS: I have unsubscribed from the list - if you would like to continue the discussion, please reply to my personal address. Thanks for your thoughts. I appreciate your point of view, I just disagree with it. Jeff Schnitzer wrote: If the client is going to use the JDBC driver, it must be able to load the class(es). This means you need to package the driver with the client application. I'm puzzled by your comments about clients not needing to care about drivers - are these classes just going to materialize out of thin air? I suppose in theory the server could do something with http classloading, but why bother with the extra complexity, security considerations, and licensing issues? You know you're going to need the classes anyways, package them with the client. Jeff -Original Message- From: Tom Mitchell [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 30, 2001 9:08 AM To: Orion-Interest Subject: Re: R: R: frustrated - jdbc: No suitable driver Again, thanks for your replies. What is curious to me is that the driver performs fine within a jsp. I look up loc with no problem. It only has a problem from a client application. And, it does not seem like a client to a DataSource should ever have to care about drivers - that is the container's job in my opinion. data-source class="com.evermind.sql.ConnectionDataSource" name="SomeDatasource" location="loc" xa-location="jdbc/xa/SomeXADS" ejb-location="ejb/weather" schema="database-schemas/postgresql.xml" connection-driver="org.postgresql.Driver" username="tom" password="tR16/4" url="jdbc:postgresql://192.168.1.5:5432/weather" inactivity-timeout="30" / Any more ideas? DeVincentiis Giustino wrote: Sorry, the message "No suitable driver" probably means a problem with jdbc driver. So if you have into the data-sources.xml the definition: data-source class="com.evermind.sql.DriverManagerDataSource" name="Hypersonic" location="jdbc/HypersonicCoreDS" xa-location="jdbc/xa/HypersonicXADS" ejb-location="jdbc/HypersonicDS" connection-driver="org.hsql.jdbcDriver" username="sa" password="" url="jdbc:HypersonicSQL:./database/defaultdb" inactivity-timeout="30" / you should lookup "jdbc/HypersonicDS", and you should have the driver classes in your /orion/lib directory. Giustino -Messaggio originale- Da: Tom Mitchell [mailto:[EMAIL PROTECTED]] Inviato: marted 30 gennaio 2001 12.24 A: Orion-Interest Oggetto: Re: R: frustrated - jdbc: No suitable driver Thanks for the reply. That is exactly how I am initializing the context in my client application: Hashtable ht = new Hashtable(); ht.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.ApplicationClientInitialContextFactory"); ht.put(Context.PROVIDER_URL, "ormi://192.168.1.3"); ht.put(Context.SECURITY_PRINCIPAL, "someUser"); ht.put(Context.SECURITY_CREDENTIALS, "secret"); // Obtain connection InitialContext ctx = new InitialContext(ht); DeVincentiis Giustino wrote: Try initializing the context this way: ... Properties props = new Properties(); props.setProperty("java.naming.factory.initial","com.evermind.s erver.Applica tionClientInitialContextFactory"); props.setProperty("java.naming.provider.url", "ormi://localhost/app-name"); props.setProperty("java.naming.security.principal", "admin"); props.setProperty("java.naming.security.credentials", "123"); InitialContext ctx = new InitialContext(props); ...
frustrated - jdbc: No suitable driver
Hi All, I am used to WebLogic, so please pardon my ignorance... I am trying to get my WebLogic application to run on Orion. I have a DataSource set up to PostgreSql. It seems OK because this Orion JSP works fine: InitialContext ctx = new InitialContext(); out.print("brContext: " + ctx); DataSource ds = (DataSource) ctx.lookup("jdbc/DefaultDS"); Connection conn = ds.getConnection(); // Create query and get results Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery("select count(*) FROM weathersnapshots"); // List results while ( rs.next() ) { out.println( "br" + rs.getObject(1) + "br"); } // Close connection - important! conn.close(); This runs fine and gives me the count of rows in the table. When I try to get the standalone client to the same DataSource to run, I get this: Context: javax.naming.InitialContext@316e52 Exception in thread "main" java.sql.SQLException: No suitable driver at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at com.evermind.sql.DriverManagerDataSource.getConnection(JAX) at Test.main(Test.java:18) No errors appear on the server's console. I can not imagine why I would want to have a DB driver's jar in my client's classpath (ALTHOUGH I HAVE TRIED THAT). I have an application-client.xml: application-client /application-client I have scoured the list archives and can not find the solution. Remember, within the container, it runs fine. It is the standalone app that does not work. Using: Orion 1.4.5 JDK 1.3 Win2K Thanks in advance. -- Tom Mitchell [EMAIL PROTECTED] Very Current Stoneham, MA Weather http://www.tom.org