473,405 Members | 2,354 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

JDBC with OUT DriverManager

bergy
89
I am writing on an embedded device (J9 framework from IBM) that has a partial version of the java.sql package. It does not include Driver or DriverManager. I have downloaded the mysql Connector/J but all of their examples use the DriverManager. Something like:

Expand|Select|Wrap|Line Numbers
  1. conn = DriverManager.getConnection("jdbc:mysql://localhost/test?" + 
  2.                                    "user=monty&password=greatsqldb");
Does anyone know of any modules that can connect to MySQL without the use of the JDBC driver manager?

Just in case someone asks, the classes I have access to are:

java.sql.BatchUpdateException
java.sql.Blob
java.sql.CallableStatement
java.sql.Clob
java.sql.Connection
java.sql.DatabaseMetaData
java.sql.DataTruncation
java.sql.Date
java.sql.PreparedStatement
java.sql.ResultSet
java.sql.ResultSetMetaData
java.sql.Savepoint
java.sql.SQLException
java.sql.SQLWarning
java.sql.Statement
java.sql.Time
java.sql.Timestamp
java.sql.Types
---------
javax.sql.DataSource
javax.sql.RowSet
javax.sql.RowSetEvent
javax.sql.RowSetInternal
javax.sql.RowSetListener
javax.sql.RowSetMetaData
javax.sql.RowSetReader
javax.sql.RowSetWriter
Jan 5 '09 #1
9 3239
Dököll
2,364 Expert 2GB
Not sure if this is right for you but, how 'bout:

mysql data - Google Search

Just some fancy links; if you have already seen these, do come back and ask more questions.

In a bit
Jan 6 '09 #2
bergy
89
I appreciate the bump of the thread, but honestly did you read my post? I know how to use MySQL or I would be posting in those forums. This is a specific Java related question, related to specific java packages - I fail to see how just searching mysql data in Google would return anything about java. Let me re-explain:

Normally, in java, you use a class called DriverManager and Driver to load the MySQL or any other JDBC driver. I'm asking if anyone knows of a work around that does not use DriverManager or Driver because the device I'm using does not include it as part of the JRE.

Sorry about the tone, but I've been researching this (via Google among other resources) for a day or two and haven't found anything. I too don't get a little annoyed when people post with out checking Google first, but I assure you this is not one of of those posts :P
Jan 6 '09 #3
JosAH
11,448 Expert 8TB
I see the DataSource interface; is there a way to obtain a DataSource implementation?

kind regards,

Jos
Jan 6 '09 #4
bergy
89
Thanks for the reply Josah; I have tried using "com.mysql.jdbc.jdbc2.optional.MysqlConnectionPool DataSource" and "com.mysql.jdbc.jdbc2.optional.MysqlDataSource " but both seem to call java.sql.Driver at some point as I'm still getting the error java.lang.NoClassDefFoundError: java.sql.Driver
Jan 6 '09 #5
JosAH
11,448 Expert 8TB
@bergy
You shouldn't need to know about these classes. All you want is an implementation of a DataSource interface. Do you have any naming services available on your device? e.g. JNDI can hand out DataSources ...

kind regards,

Jos
Jan 6 '09 #6
bergy
89
As far as I know there are no naming services, unless you count the framework's built in one which in this case won't work (as far as I can gather). There is some class introspection done at runtime that is finding the private? Driver variable in the MySQL DataSource class. I have decided to write a PHP script on the database server that I can just query using HTTP/XML. Not really the route I wanted to go but I think it's my only option at this point.

Since the code that I'm writing can still run in a normal JRE I'm leaving the DriverManager stuff in there for that situation - what I'm wondering is if there is an easy way to populate a ResultSet object with my own data that is being parsed from the XML so I can handle them the same way regardless of how I'm connecting to MySQL.
Jan 7 '09 #7
JosAH
11,448 Expert 8TB
I don't understand the availability of the javax.sql.DataSource interface then. If there is no DriverManager (nor a Driver) and you can't use that DataSource then all the other classes are moot, i.e. you can't use them. We must be missing something here ...

kind regards,

Jos
Jan 7 '09 #8
JosAH
11,448 Expert 8TB
I googled a bit more and found that J9 is a bit of a strange beast: i.e. IBM's own DB2 runs fine on it using ordinary JDBC and a DataSource; HSQLDB also seems to run fine but Sun's own Apache Derby implementation doesn't run and Oracle's DB also seems to have some problems. MySQL isn't even mentioned in all the complaint stories ...

kind regards,

Jos
Jan 7 '09 #9
bergy
89
Yes, it's quite annoying, you would think that by now, this type of thing on an embedded device would be a no brainer, but I guess not for IBM >< Thanks for your help J!
Jan 7 '09 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Nils Valentin | last post by:
Hi MySQL Fans ;-), Is it possible that the 3.08 series allows to connect to 4.0.14 versions but not to the 4.1 alpha-versions ? I get belows error when tryig to connect from DbVisualizer which...
0
by: sridhar nagabhurshana | last post by:
hello I am trying to connect to mysql database using connector/J jdbc driver this is my code import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException;
0
by: Robert Mazur | last post by:
MySQL 5.0 alpha (binary install) on Solaris 9 -or- RedHat 8.0 mysql-connector-java-3.0.8-stable ----------------------- Is there something different going on with JDBC and the alpha version...
2
by: sea | last post by:
I have DB2 UDB Workgroup version 7.2 -- the JDBC-ODBC bridge loads perfectly fine but when I try to use JDBC I get an error, copying and pasting below. I added db2java.zip and db2jdbc.dll to both...
1
by: eugene | last post by:
Happy Christmas to all (who celebrate)! It's still not clear to me... when in a java stored procedure it says: conn = DriverManager.getConnection("jdbc:default:connection"); what driver DB2...
3
by: Rakesh | last post by:
Hi, I want to get connection to a DB2 database using the driver COM.ibm.db2.jdbc.DB2XADataSource. I have also included 'db2java.zip' in the classpath. However I am getting the exception ...
2
by: %NAME% | last post by:
(Thanks to Bernd, Ian, Phil last time for their detailed answers last time) Now I try to call JDBC driver without giving the username and password as they suggested. I am using DB2 jdbc on SunOS...
5
oll3i
by: oll3i | last post by:
my librarybean package library.ejb; import java.sql.*; import javax.ejb.*; import library.common.*; @Stateless @Remote
2
by: bevis | last post by:
I'm new to sql server and mysql but this seems like it should be a pretty straight forward jdbc connection. But I have spent almost 2 days just trying to get a jdbc connection. Please help if you...
2
by: anokun7 | last post by:
Hi, I am connecting to a DB2 v7.1 server from windows using JDBC type 2 (I figured out that type 4 is only for 8 and upwards). I used DB2 Connect to create a system DSN and seem to be able to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.