473,725 Members | 2,243 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

JDBC with OUT DriverManager

bergy
89 New Member
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.BatchU pdateException
java.sql.Blob
java.sql.Callab leStatement
java.sql.Clob
java.sql.Connec tion
java.sql.Databa seMetaData
java.sql.DataTr uncation
java.sql.Date
java.sql.Prepar edStatement
java.sql.Result Set
java.sql.Result SetMetaData
java.sql.Savepo int
java.sql.SQLExc eption
java.sql.SQLWar ning
java.sql.Statem ent
java.sql.Time
java.sql.Timest amp
java.sql.Types
---------
javax.sql.DataS ource
javax.sql.RowSe t
javax.sql.RowSe tEvent
javax.sql.RowSe tInternal
javax.sql.RowSe tListener
javax.sql.RowSe tMetaData
javax.sql.RowSe tReader
javax.sql.RowSe tWriter
Jan 5 '09 #1
9 3252
Dököll
2,364 Recognized Expert Top Contributor
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 New Member
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 Recognized Expert MVP
I see the DataSource interface; is there a way to obtain a DataSource implementation?

kind regards,

Jos
Jan 6 '09 #4
bergy
89 New Member
Thanks for the reply Josah; I have tried using "com.mysql.jdbc .jdbc2.optional .MysqlConnectio nPoolDataSource " and "com.mysql.jdbc .jdbc2.optional .MysqlDataSourc e" but both seem to call java.sql.Driver at some point as I'm still getting the error java.lang.NoCla ssDefFoundError : java.sql.Driver
Jan 6 '09 #5
JosAH
11,448 Recognized Expert MVP
@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 New Member
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 Recognized Expert MVP
I don't understand the availability of the javax.sql.DataS ource 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 Recognized Expert MVP
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 New Member
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
2265
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 was working fine until a while ago. I haven't watched it recently, and haven't changed anything I am aware off right now. After I realized the problem I tried many 3.08 versions with the same symptom. Watch were it says "Unknown system variable...
0
2564
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
4245
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 of MySQL 5.0? When trying to connect I am getting: ** BEGIN NESTED EXCEPTION **
2
11688
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 the classpath and path variables, still no luck. Anyone have any ideas please? Thank you very much! java.lang.ClassNotFoundException: COM.ibm.db2.jdbc.app.DB2Driver at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
1
1792
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 database manager loads? Is it configurable on the database server side so I could switch between different JDBC driver types, i.e. 2 and 4? I am on DB2 8.1.4 AIX and Linux. Thanks,
3
27058
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 java.sql.SQLException: No suitable driver at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at Conn.main(Conn.java:44)
2
5966
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.8 with db2 version 7.2.0. When I am using the type2 network driver (COM.ibm.db2.jdbc.net.DB2Driver) with username and password, everything is fine. However, when I use the application driver: (COM.ibm.db2.jdbc.app.DB2Driver), and call...
5
2040
oll3i
by: oll3i | last post by:
my librarybean package library.ejb; import java.sql.*; import javax.ejb.*; import library.common.*; @Stateless @Remote
2
4555
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 can. I'm using Eclipse 3.2.2 and I have installed mysql-connector-java-5.0.6-bin.jar. I am trying to connect to SQL Enterprise Manager version 8.0 innstall on a Windows 2003 Server Enterprise Edition. I have been able to successfully test...
2
6671
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 connect fine using db2connect and run queries etc. The problem is when I try to use my java application to connect using the same DSN. The way the db has been configured is that I am
0
8752
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9401
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8099
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6702
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6011
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4519
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4784
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3228
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2637
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.