MySQL dB mia
I have gotten a mySQL test dB set up in the ColdFusion MX 6
Admin panel.
And I have followed this technote:
http://dev.mysql.com/doc/world-setup/en/world-setup.html
to attempt to install and access the "world" dB, with no
luck.
I type the commands at the mysql prompt and get no errors,
but nothing else happens.
Just a cursor.
Let's start at the top.
Where is the initial cursor in relationship to my dB, which
is here C:\Program Files\MySQL\MySQL Server 5.0\data ?
:-)
grab the gui tools...much easier than typing commands ;-)
http://dev.mysql.com/downloads/gui-tools/5.0.html
Then open the .sql script in the MySQL Query Browser...then
execute the
script. You can see, query, design the tables, etc. from the
query browser.
HTH
Tim Carley
www.recfusion.com
[email protected]
Similar Messages
-
Can not get PK-FK in meta-Data of MySql....Help me pls.
Hello Every one.
I can not to get the PK and FK from Meta-Data Database of mysql-4.1.1a-alpha. Anyway I tried to do the
followihg
1. OS windows 2000 Pro.
2. set configuration Script support InnoDB Table Type as the follow in my.ini file.
[mysqld-nt]
innodb_data_home_dir = C:\mysql\data
innodb_data_file_path =\ibdata\ibdata1:2000M // in folder \data\ i was created folder ibdata
3. I try to create data as reference in example java code and table :persons , shirt as the example in
Create innodb table Type of mysql doc.
4. the code test as following
In the test code i can get the result only from method : getPrimarykey(...); only and the other method ,getExportedKeys, getImportedKey , getCrossReference the result in ResultSet is null.
anyway, this code i can apply in the oracle db with change db driver .
I wish the answer why? and the actually the second parameter of this parameter , as refer scheme name , the scheme name is ?
Thank you
import java.sql.*;
public class testMeta {
public testMeta() {
ResultSet rs=null;
String url = "jdbc:mysql://localhost:3306/testinnodb";
Connection con = null;
try{
Class.forName("org.gjt.mm.mysql.Driver");
}catch(ClassNotFoundException ex){
System.out.println(ex.getMessage());
try{
con = DriverManager.getConnection(url,"root","rootpwd");
prtS("getConnection complete");
DatabaseMetaData metaData = con.getMetaData();
Connection con2 = metaData.getConnection();
String type[] = new String[1];
type[0] = new String();
prtS("*************** GET Schemas ***************");
rs = metaData.getSchemas();
while(rs.next()){
System.out.println("12345");
prtS("TABLE_CAT" + " : " + rs.getString(0));
prtS("TABLE_CAT" + " : " + rs.getString("TABLE_SCHEM "));
rs=null;
prtS("*************** GET PRIMARY KEYS ***************");
rs = metaData.getPrimaryKeys(con.getCatalog(),null,"persons");
while(rs.next()){
prtS("TABLE_CAT" + " : " + rs.getString("TABLE_CAT"));
prtS("TABLE_SCHEM" + " : " + rs.getString("TABLE_SCHEM"));
prtS("TABLE_NAME" + " : " + rs.getString("TABLE_NAME"));
prtS("COLUMN_NAME" + " : " + rs.getString("COLUMN_NAME"));
prtS("KEY_SEQ" + " : " + rs.getString("KEY_SEQ"));
prtS("PK_NAME" + " : " + rs.getString("PK_NAME"));
rs=null;
prtS("*************** GET Exported KEYS ***************");
rs = metaData.getExportedKeys(con.getCatalog(),null,"shirt");
while(rs.next()){
prtS("FKCOLUMN_NAME" + " : " + rs.getString("FKCOLUMN_NAME"));
rs=null;
prtS("*************** GET Imported KEYS ***************");
rs = metaData.getImportedKeys(con.getCatalog(),null,"persons");
while(rs.next()){
prtS("PKTABLE_CAT" + " : " + rs.getString("PKTABLE_CAT"));
rs=null;
prtS("*************** GET CrossReference ***************");
rs = metaData.getCrossReference(con.getCatalog(),null,"persons",con.getCatalog(),null,"shirts");
while(rs.next()){
prtS("PKTABLE_CAT" + " : " + rs.getString("PKTABLE_CAT"));
}catch(SQLException ex){
prtS(ex.getMessage());How i know the jdbc driver not compatible to this
mechanismBy reading the documentation tthat comes with your driver. Recent versions of the MySQL JDBC driver do support the getExportedKeys/ImportegKeys methods but the table needs to be crated as InnoDB.
So run the SQL command
show table statusWhats under the Type column for your table? If it isn't InnoDB then this isn't going to work.
If it is InnoDB but getExportedKeys/ImportegKeys still don't work then you haven't used the "foreign key" constraint in your "create table" command -
Strange scenario,Oracle can not display the data in mysql correctly
I use Heterogeneous Service+ODBC to achieve "oracle access mysql"(any other method?),and now i find Oracle can not display the data in mysql correctly:
-------mysql------------
mysql> create table tst(id int,name varchar(10));
Query OK, 0 rows affected (0.00 sec)
mysql> insert into tst values(1,'a');
Query OK, 1 row affected (0.00 sec)
mysql> select * from tst;
------------+
| id | name |
------------+
| 1 | a |
------------+
1 row in set (0.00 sec)
mysql> show create table tst\G
*************************** 1. row ***************************
Table: tst
Create Table: CREATE TABLE `tst` (
`id` int(11) DEFAULT NULL,
`name` varchar(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8
1 row in set (0.00 sec)
-------------oracle ------------------
SQL> select count(*) from "tst"@mysql;
COUNT(*)
49
SQL> select * from "tst"@mysql;
id
1
SQL> desc "tst"@mysql;
Name Null? Type
id NUMBER(10)You can make the following query on the result page:
"select * from the_table where movietitle = ? and cinema = ?"
then you set movietitle and cinema to those which the user selected. If the resultset contains more than 0 rows, that means the movie is available.
Below is the sample code, it assumes you have a connection to the database:
PreparedStatement stat = myConnection.prepareStatement("select * from the_table where movietitle = ? and cinema = ?");
stat.setString(1, usersMovieTitleSelection);
stat.setString(2, usersCinemaSelection);
ResultSet res = stat.executeQuery();
if (res.next()) {
out.print("The movie is available");
} else {
out.print("The movie is not available");
}Now just add that to your JSP page. Enjoy ! =) -
How can I create a new table in a MySQL database in MVC 5
I have an MVC 5 app, which uses MySQL hosted in Azure as a data source. The point is that inside the database, I want to create a new table called "request". I have already activated migrations for my database in code. I also have the following
code in my app.
Request.cs: (inside Models folder)
public class Request
public int RequestID { get; set; }
[Required]
[Display(Name = "Request type")]
public string RequestType { get; set; }
Test.cshtml:
@model Workfly.Models.Request
ViewBag.Title = "Test";
<h2>@ViewBag.Title.</h2>
<h3>@ViewBag.Message</h3>
@using (Html.BeginForm("SaveAndShare", "Home", FormMethod.Post, new { enctype = "multipart/form-data" }))
@Html.AntiForgeryToken()
<h4>Create a new request.</h4>
<hr />
@Html.ValidationSummary("", new { @class = "text-danger" })
<div class="form-group">
@Html.LabelFor(m => m.RequestType, new { @class = "col-md-2 control-label" })
<div class="col-md-10">
@Html.TextBoxFor(m => m.RequestType, new { @class = "form-control", @id = "keywords-manual" })
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" class="btn btn-default" value="Submit!" />
</div>
</div>
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
HomeController.cs:
[HttpPost]
public ActionResult SaveAndShare(Request request)
if (ModelState.IsValid)
var req = new Request { RequestType = request.RequestType };
return RedirectToAction("Share");
The point is that, I want the user to fill the form inside the Test view and click submit, and when the submit is clicked, I want a new entry in the new table to be created. But first of course I need to create the table. Should I create it using SQL query
through MySQL workbench? If yes, then how can I connect the new table with my code? I guess I need some DB context but don't know how to do it. If someone can post some code example, I would be glad.
UPDATE:
I created a new class inside the Models folder and named it RequestContext.cs, and its contents can be found below:
public class RequestContext : DbContext
public DbSet<Request> Requests { get; set; }
Then, I did "Add-Migration Request", and "Update-Database" commands, but still nothing. Please also note that I have a MySqlInitializer class, which looks something like this:
public class MySqlInitializer : IDatabaseInitializer<ApplicationDbContext>
public void InitializeDatabase(ApplicationDbContext context)
if (!context.Database.Exists())
// if database did not exist before - create it
context.Database.Create();
else
// query to check if MigrationHistory table is present in the database
var migrationHistoryTableExists = ((IObjectContextAdapter)context).ObjectContext.ExecuteStoreQuery<int>(
string.Format(
"SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = '{0}' AND table_name = '__MigrationHistory'",
// if MigrationHistory table is not there (which is the case first time we run) - create it
if (migrationHistoryTableExists.FirstOrDefault() == 0)
context.Database.Delete();
context.Database.Create();Hello Toni,
Thanks for posting here.
Please refer the below mentioned links:
http://azure.microsoft.com/en-us/documentation/articles/web-sites-dotnet-deploy-aspnet-mvc-app-membership-oauth-sql-database/
http://social.msdn.microsoft.com/Forums/en-US/3a3584c4-f45f-4b00-b676-8d2e0f476026/tutorial-problem-deploy-a-secure-aspnet-mvc-5-app-with-membership-oauth-and-sql-database-to-a?forum=windowsazurewebsitespreview
I hope that helps.
Best Regards,
Sadiqh Ahmed -
Issue in bringing up CRS on ATG 10.1.1 with MySQL and Weblogic 10.3
Hello,
I am trying to bring up Commerce Reference Store as part of my evaluation using MySQL (bundled with ATG) and WebLogic 10.3.
I followed the ATG Documentation on CRS with WebLogic and MySQL and I could not proceed because of the below error log. I keep getting error in OnlineCreateServerInstanceTask of CIM. I believe it should be some configuration problem, but could not think of any.
As part of the installation, I use C:\jdk1.6.0_25. I verified my weblogic server is up through the admin console. I started MySQL before running the eval batch. Apart from starting MySQL server, I did not make any datasource/database configuration changes for ATG. I have not run any other scripts to configure MySQL too.
Please guide me to resolve the problem.
C:\ATG\ATG10.1.1\CommerceReferenceStore\Store\eval>configureEval.bat
Do you wish to run the CRS evaluation installation? [Y/N]: y
Do you wish to use an existing database for the CRS evaluation? [Y/N]: n
The CRS evaluation install will attempt to create the database. Press [Return] t
o continue or any other key to quit:
Enter mysql database connection details
Enter user name: admin
Enter user password: admin
Enter database name: crsprod
Enter 'root' user password:
Creating database...
Finished database creation
Enter weblogic admin server URL: http://localhost:7001
Enter weblogic admin server username: weblogic
Enter weblogic admin server password: weblogic123
Buildfile: C:\ATG\ATG10.1.1\CommerceReferenceStore\Store\eval\evalbuild.xml
all:
[copy] Copying 1 file to C:\ATG\ATG10.1.1\CommerceReferenceStore\Store\eval
[delete] Deleting: C:\ATG\ATG10.1.1\CommerceReferenceStore\Store\eval\cimOut.
cim.tmp
BUILD SUCCESSFUL
Total time: 0 seconds
Application Server: weblogic
The following installed ATG components are being used to launch:
ATGPlatform version 10.1.1 installed at C:\ATG\ATG10.1.1
Created "C:\ATG\ATG10.1.1\home\CIM\startDynamo.jar" in 15,273ms.
Nucleus running
atg.cim.productconfig.productselector.ProductSelectionContextTask starting...
(Searching for products... done.)
atg.cim.productconfig.productselector.ProductSelectionContextTask finished.
atg.cim.productconfig.appserver.AppServerSelectTask starting...
atg.cim.productconfig.appserver.AppServerSelectTask finished.
atg.cim.productconfig.appserver.AppServerPathTask starting...
atg.cim.productconfig.appserver.AppServerPathTask finished.
atg.cim.productconfig.appserver.DomainPathTask starting...
atg.cim.productconfig.appserver.DomainPathTask finished.
atg.cim.productconfig.appserver.UrlTask starting...
atg.cim.productconfig.appserver.UrlTask finished.
atg.cim.productconfig.appserver.UsernameTask starting...
atg.cim.productconfig.appserver.UsernameTask finished.
atg.cim.productconfig.appserver.PasswordTask starting...
atg.cim.productconfig.appserver.PasswordTask finished.
atg.cim.productconfig.appserver.AppServerSelectionPersistenceTask starting...
atg.cim.productconfig.appserver.AppServerSelectionPersistenceTask finished.
atg.cim.database.CreateSchemaTask starting...
atg.cim.database.CreateSchemaTask finished.
atg.cim.database.ImportDataTask starting...
Combining template tasks...Success
Importing (1 of 1) /CIM/tmp/import/nonswitchingCore-import1.xml:
/CommerceReferenceStore/Store/Storefront/data/pricelists.xml to /atg/commerce/pr
icing/priceLists/PriceLists
/CommerceReferenceStore/Store/Storefront/data/stores.xml to /atg/store/stores/St
oreRepository
/CommerceReferenceStore/Store/Storefront/data/catalog-i18n.xml to /atg/commerce/
catalog/ProductCatalog
/CommerceReferenceStore/Store/Storefront/data/pricelists-i18n.xml to /atg/commer
ce/pricing/priceLists/PriceLists
/CommerceReferenceStore/Store/Storefront/data/sites.xml to /atg/multisite/SiteRe
pository
/CommerceReferenceStore/Store/Storefront/data/sites-i18n.xml to /atg/multisite/S
iteRepository
/CommerceReferenceStore/Store/Storefront/data/promos-i18n.xml to /atg/commerce/c
atalog/ProductCatalog
/CommerceReferenceStore/Store/Storefront/data/seotags-i18n.xml to /atg/seo/SEORe
pository
/CommerceReferenceStore/Store/Storefront/data/wishlists.xml to /atg/commerce/gif
ts/Giftlists
/CommerceReferenceStore/Store/Storefront/data/inventory.xml to /atg/commerce/inv
entory/InventoryRepository
/CommerceReferenceStore/Store/Storefront/data/users.xml to /atg/userprofiling/Pr
ofileAdapterRepository
/CommerceReferenceStore/Store/Storefront/data/orders.xml to /atg/commerce/order/
OrderRepository
/CommerceReferenceStore/Store/Storefront/data/orders-i18n.xml to /atg/commerce/o
rder/OrderRepository
/CommerceReferenceStore/Store/Storefront/data/storetext-i18n.xml to /atg/store/s
tores/StoreRepository
/CommerceReferenceStore/Store/Storefront/data/claimable-i18n.xml to /atg/commerc
e/claimable/ClaimableRepository
... > Success
All Imports Completed Successfully
atg.cim.database.ImportDataTask finished.
atg.cim.worker.common.PropertyFileClearPersistanceTask starting...
atg.cim.worker.common.PropertyFileClearPersistanceTask finished.
atg.cim.productconfig.serverinstance.ServerInstanceNameTask starting...
atg.cim.productconfig.serverinstance.ServerInstanceNameTask finished.
atg.cim.productconfig.serverinstance.PortBindingsSelectTask starting...
atg.cim.productconfig.serverinstance.PortBindingsSelectTask finished.
atg.cim.worker.common.MapPropertyFileCreatorTask starting...
atg.cim.worker.common.MapPropertyFileCreatorTask finished.
atg.cim.worker.common.MapPropertyFileCreatorTask starting...
atg.cim.worker.common.MapPropertyFileCreatorTask finished.
atg.cim.worker.common.MapPropertyFileCreatorTask starting...
atg.cim.worker.common.MapPropertyFileCreatorTask finished.
atg.cim.worker.common.MapPropertyFileCreatorTask starting...
atg.cim.worker.common.MapPropertyFileCreatorTask finished.
atg.cim.worker.common.MapPropertyFileCreatorTask starting...
atg.cim.worker.common.MapPropertyFileCreatorTask finished.
atg.cim.worker.common.MapPropertyFileCreatorTask starting...
atg.cim.worker.common.MapPropertyFileCreatorTask finished.
atg.cim.worker.common.MapPropertyFileCreatorTask starting...
atg.cim.worker.common.MapPropertyFileCreatorTask finished.
atg.cim.worker.common.MapPropertyFileCreatorTask starting...
atg.cim.worker.common.MapPropertyFileCreatorTask finished.
atg.cim.worker.common.MapPropertyFileCreatorTask starting...
atg.cim.worker.common.MapPropertyFileCreatorTask finished.
atg.cim.worker.common.MapPropertyFileCreatorTask starting...
atg.cim.worker.common.MapPropertyFileCreatorTask finished.
atg.cim.worker.common.MapPropertyFileCreatorTask starting...
atg.cim.worker.common.MapPropertyFileCreatorTask finished.
atg.cim.worker.common.MapPropertyFileCreatorTask starting...
atg.cim.worker.common.MapPropertyFileCreatorTask finished.
atg.cim.worker.common.MapPropertyFileCreatorTask starting...
atg.cim.worker.common.MapPropertyFileCreatorTask finished.
atg.cim.worker.common.MapPropertyFileCreatorTask starting...
atg.cim.worker.common.MapPropertyFileCreatorTask finished.
atg.cim.productconfig.serverinstance.MakeServerInstanceFromPatternTask starting.
atg.cim.productconfig.serverinstance.MakeServerInstanceFromPatternTask finished.
atg.cim.productconfig.appassembly.EarFileNameTask starting...
atg.cim.productconfig.appassembly.EarFileNameTask finished.
atg.cim.productconfig.deploy.weblogic.OnlineCreateServerInstanceTask starting...
Error Executing Batch File
atg.cim.worker.TaskException: Error deploying to weblogic
atg.cim.worker.TaskException: Error exececuting batch file
at atg.cim.flow.CimFlowCreator.startHeadlessCimFlow(CimFlowCreator.java:
130)
at atg.cim.Launcher.startCimFlow(Launcher.java:278)
at atg.cim.Launcher.main(Launcher.java:99)
Caused by: atg.cim.worker.TaskException: Error deploying to weblogic
at atg.cim.worker.Task.handleException(Task.java:72)
at atg.cim.productconfig.deploy.weblogic.OnlineCreateServerInstanceTask.
execute(OnlineCreateServerInstanceTask.java:159)
at atg.cim.headless.HeadlessExecutorImpl.executeTasks(HeadlessExecutorIm
pl.java:150)
at atg.cim.headless.HeadlessExecutorImpl.populateAndExecuteHeadlessTasks
(HeadlessExecutorImpl.java:140)
at atg.cim.batch.BatchChooserExecutor.populateAndExecuteHeadlessTasks(Ba
tchChooserExecutor.java:169)
at atg.cim.flow.CimFlow.headlessFlow(CimFlow.java:116)
at atg.cim.flow.CimFlowCreator.startHeadlessCimFlow(CimFlowCreator.java:
120)
... 2 more
Caused by: C:\ATG\ATG10.1.1\CIM\plugins\Base\ant\cim-ant.xml:348: The following
error occurred while executing this line:
C:\ATG\ATG10.1.1\CIM\plugins\Base\ant\cim-ant.xml:254: The following error occur
red while executing this line:
C:\ATG\ATG10.1.1\CIM\plugins\Base\ant\cim-ant.xml:214: exec returned: 1
at org.apache.tools.ant.ProjectHelper.addLocationToBuildException(Projec
tHelper.java:541)
at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.jav
a:394)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor132.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a:105)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
at atg.cim.task.ant.utility.AntExecutionWrapper.executeAntTarget(AntExec
utionWrapper.java:167)
at atg.cim.worker.AntTask.executeAntTarget(AntTask.java:115)
at atg.cim.productconfig.deploy.weblogic.OnlineCreateServerInstanceTask.
execute(OnlineCreateServerInstanceTask.java:155)
... 7 more
Caused by: C:\ATG\ATG10.1.1\CIM\plugins\Base\ant\cim-ant.xml:254: The following
error occurred while executing this line:
C:\ATG\ATG10.1.1\CIM\plugins\Base\ant\cim-ant.xml:214: exec returned: 1
at org.apache.tools.ant.ProjectHelper.addLocationToBuildException(Projec
tHelper.java:541)
at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.jav
a:394)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor132.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a:105)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:62)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor132.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a:105)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.jav
a:391)
... 20 more
Caused by: C:\ATG\ATG10.1.1\CIM\plugins\Base\ant\cim-ant.xml:214: exec returned:
1
at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:636)
at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:662)
at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:487)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor132.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a:105)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:62)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor132.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a:105)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.jav
a:391)
... 34 more
Nucleus shutting down
Nucleus shutdown complete
Thanks.This error is resolved after following the logs in C:\ATG\ATG10.1.1\CIM\log\cim.log. The root cause is I used http as protocol instead of t3 while specifying weblogic admin url.
http://localhost:7001 instead of t3://localhost:7001
Thanks. -
Conversion of Mysql query in oracle acceptable query format
Hi
I have successfully converted my MySql database in oracle. Now the problem is how to execute already written hundreds of Mysql query on the oracle. There are many syntax variation in Mysql query format which is not acceptable for oracle.
For Example
Select case_id as 'this is alias' from cases
The above query can run on Mysql database but have problem while executing Oracle, because single quotes should be replaced with double quotes before executing it on oracle. There are also many other syntax conflicts.
I have tried to resolve the problem through SwisSQLAPI but problem still exist as SwisSQLAPI is not dealing with all syntax conflict. In my case (select if (expresion, true,false)) must be replace with decode (expression, value,true,false) function of oracle and this conversion is not supported by SwisSQLAPI.
Please help me in resolving this problem
ThanksThe problem with trying to port from one language (mysql SQL) to another (oracle SQL) is that there's generally no hard rules for a computer to follow, that it will get it 100% correct.
Look at babelfish when you translate a foreign language to English. The end result is readable (usually), but it's rarely completely correct.
The problem is when you feed something into Oracle SQL, it needs to be 100% correct.
All you can really do here is rewrite these queries. It shouldn't actually take as long as you think, because 50% of queries will generally need very minor changes you can do in a minute, and 25% won't need any changes at all. -
Date syntax for MySql query in SQL Reporting Services
I am currently trying to link a mysql Stored Procedure to a Microsoft SQL Reporting Server. It is coming up with a Syntax error. I believe this is down to the
Date_from and Date_to Parameters. The query is below any help would be appreciated
DELIMITER $$
USE `mydb`$$
DROP PROCEDURE IF EXISTS `DTI`$$
CREATE DEFINER=`linkeduser`@`%` PROCEDURE `DTI`(IN date_from DATETIME,
IN date_to DATETIME)
BEGIN
SELECT title,gender,firstname,lastname,address1,town,postcode,dob,IF(co.start_date = '00-00-0000', '', CAST(DATE(co.start_date) AS DATE)) AS 'StartDate'
FROM cf_user AS us
JOIN ca_compliance AS co ON co.user_id = us.user_id
WHERE co.start_date BETWEEN date_from AND date_to;
END$$
DELIMITER ;Hello,
The dataset query runs on the external data source.
In your case, you create a report by retrieve data from MySQL database with a stored procedure. The stored procedure will run on MySQL Server and return the result in the Report designer or Report Builder. To solved this issue, please execute the stored
procedure on the MySQL database and check the syntax error.
Regards,
Fanny Liu
Fanny Liu
TechNet Community Support -
Snort error since recent mysql update
Is anybody else seeing this error message when they execute snort? I'm not sure if this is my setup or a bug that needs to be reported.
"snort: error while loading shared libraries: libmysqlclient.so.14: cannot open shared object file: No such file or directory"
This error returns when executing either the snort binary in the Arch snort package or a self compiled snort binary.
The libmysqlclient.so.14 file does exist, it is here:
/usr/lib/mysql
-rwxr-xr-x 1 root root 888 Oct 27 11:11 libmysqlclient.la
lrwxrwxrwx 1 root root 24 Oct 27 12:17 libmysqlclient.so -> libmysqlclient.so.14.0.0
lrwxrwxrwx 1 root root 24 Oct 27 12:17 libmysqlclient.so.14 -> libmysqlclient.so.14.0.0
-rwxr-xr-x 1 root root 1.1M Oct 27 11:11 libmysqlclient.so.14.0.0
Thanks,
CraigI am seeing the same problem with my perl scripts that use DBI.
bash> ldd /usr/lib/perl5/site_perl/current/i686-linux-thread-multi/auto/DBD/mysql/mysql.so
linux-gate.so.1 => (0xffffe000)
libmysqlclient.so.12 => not found
libz.so.1 => /usr/lib/libz.so.1 (0x40025000)
libcrypt.so.1 => /lib/tls/libcrypt.so.1 (0x40037000)
libnsl.so.1 => /lib/tls/libnsl.so.1 (0x40064000)
libm.so.6 => /lib/tls/libm.so.6 (0x40079000)
libssl.so.0.9.7 => /usr/lib/libssl.so.0.9.7 (0x4009c000)
libcrypto.so.0.9.7 => /usr/lib/libcrypto.so.0.9.7 (0x400cd000)
libc.so.6 => /lib/tls/libc.so.6 (0x401d3000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)
libdl.so.2 => /lib/tls/libdl.so.2 (0x40309000)
mysql.so is refrencing libmysqlclient.so.12 which is no longer available due to upgrade. -
I am using JSP and MYSQL with a bean that does my database work.
my search.jsp looks up records, when I click edit it sends the values to my inventory_admin.jsp
When I make the changes to the data, the data is not saved in the database.
Please, look see!
<!--search.jsp-->
<jsp:useBean id="inventoryBean" scope="session" class="mybeans.inventoryBean" />
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<%// Do search with bean.
String s = request.getParameter("searchField");
int searchId = -1;
if(s != null)
try
searchId = Integer.parseInt(s);
catch(NumberFormatException e) {}
//Do actual search with bean
boolean rc = false;
if(searchId != -1)
rc = inventoryBean.findByPrimaryKey(searchId);
%>
<form action="search.jsp" method="post" enctype="application/x-www-form-urlencoded">
<h2 align="center">Software Inventory </h2>
<p align="center"> </p>
<p>Lookup:
<input name="searchField" type="text" id="searchField">
<input type="submit" name="Submit" value="Submit">
</p>
</form>
<%
//Output 'not found' message if needed
if(rc == false)
out.println("<P><B>Product not found</B></P>");
%>
<table width="25%" border="0">
<tr>
<td>Item ID:</td>
<td><jsp:getProperty name="inventoryBean" property="itemid" /></td>
</tr>
<tr>
<td>Product Name:</td>
<td><jsp:getProperty name="inventoryBean" property="item" /></td>
</tr>
<tr>
<td>Platform:</td>
<td><jsp:getProperty name="inventoryBean" property="platform" /></td>
</tr>
<tr>
<td>Serial:</td>
<td><jsp:getProperty name="inventoryBean" property="serial" /></td>
</tr>
<tr>
<td>Description:</td>
<td><jsp:getProperty name="inventoryBean" property="description" /></td>
</tr>
</table>
<p>&nosave=yes">EDIT</a></p>
<p align="center"> </p>
</body>
</html>
<!--inventory_admin.jsp-->
<jsp:useBean id="inventoryBean" scope="session" class="mybeans.inventoryBean" />
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<%-- Copy all form variables at once into the bean--%>
<jsp:setProperty name="inventoryBean" property="*" />
<%
boolean saveResult = false;
boolean notSaved = false;
//Save our changes
String s = request.getParameter("nosave");
if(s == null || s.equals("yes") == false)
saveResult = inventoryBean.update();
else
notSaved = true;
//Do search with bean
s = request.getParameter("itemid");
int searchId = -1;
if(s != null)
try
searchId = Integer.parseInt(s);
catch(NumberFormatException e) {}
//Do actual search with Bean
boolean rc;
if(searchId != -1)
rc = inventoryBean.findByPrimaryKey(searchId);
%>
<h2 align="center">Software Inventory - Edit Mode</h2>
<FORM action="inventory_admin.jsp" method="post" enctype="application/x-www-form-urlencoded">
<table width="25%" border="0">
<tr>
<td>ITEMID</td>
<td><jsp:getProperty name="inventoryBean" property="itemid" /></td>
</tr
<tr>
<td>Product Name:</td>
<td><input name="description" type="text" value="<jsp:getProperty name="inventoryBean" property="item" />"></td>
</tr>
<tr>
<td>Platform:</td>
<td><input name="description" type="text" value="<jsp:getProperty name="inventoryBean" property="platform" />"></td>
</tr>
<tr>
<td>Serial:</td>
<td><input name="description" type="text" value="<jsp:getProperty name="inventoryBean" property="serial" />"></td>
</tr>
<tr>
<td>Description:</td>
<td><input name="description" type="text" value="<jsp:getProperty name="inventoryBean" property="description" />"></td>
</tr>
</table>
<%
if(notSaved == false)
if(saveResult == true)
out.println("Changes saved");
else
out.println("Changes NOT saved");
%>
<p><input type="submit" name="Submit" value="Submit"></p>
<p align="center"> </p>
</FORM>
</body>
</html>
//inventory.java
Here is the Bean Im using:
// inventoryBean.java - Simple database bean for table products
package mybeans; // Our custom 'package'.
import mybeans.DBConfigInfo; // Import helper classes
import mybeans.DBWorker; // for simpler database programming.
// Import other packages here.
import java.sql.*; // For database access.
import java.util.Hashtable; // For findRecords().
public class inventoryBean
private boolean isBeanDataValid = false; // Set when bean contains valid data.
private boolean isDBError = false; // Stores whether there was a processing error.
private String dbErrorMsg = "(No error)";
private DBWorker dbWorker; // Helper object for JDBC programming.
// Attributes
private String item = "";
private String platform = "";
private String serial = "";
private String description = "";
private int itemid = 0; // Primary key field
public void clear()
// Clears data in all your properties to 'empty' state.
item = "";
platform = "";
serial = "";
description = "";
itemid = 0; // Primary key field
// Accessor Methods
public void setItem(String newItem) { item = newItem; }
public String getItem() { return item; }
public void setPlatform(String newPlatform) { platform = newPlatform; }
public String getPlatform() { return platform; }
public void setSerial(String newSerial) { serial = newSerial; }
public String getSerial() { return serial; }
public void setDescription(String newDescription) { description = newDescription; }
public String getDescription() { return description; }
public void setItemid(int newItemid) { itemid = newItemid; }
public int getItemid() { return itemid; }
// Operations
// Default constructor.
public inventoryBean()
// Create a helper object to work with database.
// DO NOT DELETE THIS CODE.
dbWorker = new DBWorker();
// Database Operations
// Built-in methods:
public boolean findByPrimaryKey(int searchId)
// Use this method to find 1 record by primary key for your table.
// (After this call, all fields will be loaded into your properties.)
// Clear existing data, if any.
clear();
isBeanDataValid = false;
// Query by primary key.
boolean rc = dbWorker.open();
if(rc == false)
isDBError = true;
dbErrorMsg = dbWorker.errorMsg;
return false;
try
// 1) Get a connection.
Connection conn = dbWorker.getConnection();
// 2) Create a statement.
Statement st = conn.createStatement();
// 3) Build your SQL.
String sql = "SELECT item, platform, serial, description, " +
"itemid " +
"FROM products " +
"WHERE itemid=" + searchId;
//System.out.println("DEBUG SQL =" + sql);
// 4) Get a result set.
ResultSet rs = st.executeQuery(sql);
// 5) Move to first record
if(rs.next())
// 6) Retrieve fields into your properties using JDBC get??? methods.
item = rs.getString("item");
platform = rs.getString("platform");
serial = rs.getString("serial");
description = rs.getString("description");
itemid = rs.getInt("itemid");
// 7) Ensure non-null String fields with dbWorker.safeStr()
item = dbWorker.safeStr(item);
platform = dbWorker.safeStr(platform);
serial = dbWorker.safeStr(serial);
description = dbWorker.safeStr(description);
// Set result code.
isBeanDataValid = true;
// 8) Close all DB objects.
rs.close();
st.close();
dbWorker.close(); // Connection too.
catch(SQLException e)
System.out.println("Error in findByPrimaryKey (" + e.getMessage() + ")");
return isBeanDataValid;
// Update a record
public boolean update()
// Use this to update a record by a primary key.
boolean resultCode = false;
// Query by primary key.
boolean rc = dbWorker.open();
if(rc == false)
isDBError = true;
dbErrorMsg = dbWorker.errorMsg;
return false;
try // Remember to put all DB code inside a try block!
// 1) Get a connection.
Connection conn = dbWorker.getConnection();
// 2) Create a statement.
Statement st = conn.createStatement();
// 3) Build your SQL.
String sql = "UPDATE products SET item=" + dbWorker.sqlStr(item) + "," +
"platform=" + dbWorker.sqlStr(platform) + "," +
"serial=" + dbWorker.sqlStr(serial) + "," +
"description=" + dbWorker.sqlStr(description)+
" WHERE itemid=" + itemid;
//System.out.println("DEBUG SQL =" + sql);
// 4) Run action query.
int rowsAffected = st.executeUpdate(sql);
// 5) See if we succeeded (1 recorded affected).
if(rowsAffected == 1)
resultCode = true;
else
System.out.println("Warning: Can't update in update()!");
// 6) Close all DB objects.
st.close();
dbWorker.close(); // Connection too.
catch(SQLException e)
System.out.println("Error in update (" + e.getMessage() + ")");
return resultCode;
// Delete a record
public boolean delete(int deleteId)
// Use this to delete a record by a primary key.
boolean resultCode = false;
// Query by primary key.
boolean rc = dbWorker.open();
if(rc == false)
isDBError = true;
dbErrorMsg = dbWorker.errorMsg;
return false;
try
// 1) Get a connection.
Connection conn = dbWorker.getConnection();
// 2) Create a statement.
Statement st = conn.createStatement();
// 3) Build your SQL.
String sql = "DELETE FROM products WHERE itemid=" + deleteId;
//System.out.println("DEBUG SQL =" + sql);
// 4) Run action query.
int rowsAffected = st.executeUpdate(sql);
// 5) See if we succeeded (1 recorded affected).
if(rowsAffected == 1)
resultCode = true;
else
System.out.println("Warning: Can't delete ID #" + deleteId + " in delete()!");
// 6) Close all DB objects.
st.close();
dbWorker.close(); // Connection too.
catch(SQLException e)
System.out.println("Error in delete (" + e.getMessage() + ")");
return resultCode;
// Insert a new record.
public boolean insert(String newItem, String newPlatform, String newSerial, String newDescription,
int newItemid)
// Use this to update a record by a primary key.
boolean resultCode = false;
// Query by primary key.
boolean rc = dbWorker.open();
if(rc == false)
isDBError = true;
dbErrorMsg = dbWorker.errorMsg;
return false;
try // Remember to put all DB code inside a try block!
// 1) Get a connection.
Connection conn = dbWorker.getConnection();
// 2) Create a statement.
Statement st = conn.createStatement();
// 3) Build your SQL.
String sql="INSERT INTO products(item, platform, serial, description, " +
"itemid) " +
"VALUES(" + dbWorker.sqlStr(newItem) + "," + dbWorker.sqlStr(newPlatform) + "," + dbWorker.sqlStr(newSerial) + "," + dbWorker.sqlStr(newDescription) + "," +
newItemid + ")";
//System.out.println("DEBUG SQL =" + sql);
// 4) Run action query.
int rowsAffected = st.executeUpdate(sql);
// 5) See if we succeeded (1 recorded affected).
if(rowsAffected == 1)
resultCode = true;
else
System.out.println("Warning: Can't update in insert()!");
// 6) Close all DB objects.
st.close();
dbWorker.close(); // Connection too.
catch(SQLException e)
System.out.println("Error in insert (" + e.getMessage() + ")");
return resultCode;
public int findMaxPrimaryKey()
// Use this method to find the current max. value for a primary key
// in the database for a given table.
int retVal = -1;
// Query by primary key.
boolean rc = dbWorker.open();
if(rc == false)
isDBError = true;
dbErrorMsg = dbWorker.errorMsg;
return -1;
try // Remember to put all DB code inside a try block!
// 1) Get a connection.
Connection conn = dbWorker.getConnection();
// 2) Create a statement.
Statement st = conn.createStatement();
// 3) Build your SQL.
String sql = "SELECT MAX(itemid) FROM products";
//System.out.println("DEBUG SQL =" + sql);
// 4) Get a result set.
ResultSet rs = st.executeQuery(sql);
// 5) Move to first record
if(rs.next())
// 6) Retrieve fields into your properties using JDBC get??? methods.
retVal = rs.getInt(1); // Get first and only column.
// 7) Close all DB objects.
rs.close();
st.close();
dbWorker.close(); // Connection too.
catch(SQLException e)
System.out.println("Error in findMaxPrimaryKey (" + e.getMessage() + ")");
return retVal;
public Hashtable findRecords(String filter, String orderBy)
// Use this method to return a Hashtable filled with
// one or more records. You can specified a 'filter'
// for finding records and 'orderBy' will determine the sort order.
Hashtable retVal = new Hashtable();
retVal.put("ROWCOUNT", "0");
retVal.put("COLUMNCOUNT", "0");
retVal.put("STATUS", "EMPTY");
// Query by primary key.
boolean rc = dbWorker.open();
if(rc == false)
isDBError = true;
dbErrorMsg = dbWorker.errorMsg;
return retVal;
try // Remember to put all DB code inside a try block!
// 1) Get a connection.
Connection conn = dbWorker.getConnection();
// 2) Create a statement.
Statement st = conn.createStatement();
// 3) Build your SQL.
String sql = "SELECT item, platform, serial, description, " +
"itemid " +
"FROM products " +
"WHERE " + filter + " " +
"ORDER BY " + orderBy;
//System.out.println("DEBUG SQL =" + sql);
// 4) Get a result set.
ResultSet rs = st.executeQuery(sql);
int rowCount = 0;
// 5) Move to first record (and then next) record.
while(rs.next())
// 6) Retrieve fields into your properties using JDBC get??? methods.
String thisItem = rs.getString("item");
String thisPlatform = rs.getString("platform");
String thisSerial = rs.getString("serial");
String thisDescription = rs.getString("description");
int thisItemid = rs.getInt("itemid");
// 7) Ensure non-null String fields with dbWorker.safeStr()
thisItem = dbWorker.safeStr(thisItem);
thisPlatform = dbWorker.safeStr(thisPlatform);
thisSerial = dbWorker.safeStr(thisSerial);
thisDescription = dbWorker.safeStr(thisDescription);
// 8) Load this row into our Hashtable.
// The convention here is to pack each row's column name with an ID
// indicating the row. "ProjectId" + "0" = "ProjectId0" ===mapped to===> Value
// Put this record into Hashtable.
retVal.put("item" + rowCount, thisItem);
retVal.put("platform" + rowCount, thisPlatform);
retVal.put("serial" + rowCount, thisSerial);
retVal.put("description" + rowCount, thisDescription);
retVal.put("itemid" + rowCount, "" + thisItemid);
rowCount++;
// 9) Close all DB objects.
rs.close();
st.close();
dbWorker.close(); // Connection too.
// Write info to our hashtable--Since this container hold virtually anything,
// you can put in whatever 'metadata' you want about your result set.
retVal.put("ROWCOUNT", "" + rowCount);
retVal.put("COLUMNCOUNT", "5");
retVal.put("STATUS", "OK");
catch(SQLException e)
System.out.println("Error in findRecords (" + e.getMessage() + ")");
retVal.put("STATUS", "ERROR");
return retVal;
//============================================================
// DO NOT CHANGE THE CODE BELOW.
//============================================================
public boolean isValid()
// Does bean contain real data?
return isBeanDataValid;
public boolean isError()
// Returns true if there was a DB error.
return isDBError;
public String getErrorMsg()
// Returns error message, if any.
return dbErrorMsg;
//=====================================================================
// TODO: Remember to comment out main() with /* */ for production code!
//=====================================================================
// TEST DRIVER CODE
public static void main(String[] args)
// Test driver code goes here.
String beanName = "inventoryBean";
String tableName = "products";
boolean isDataValidationError = false;
// Exercise CRUD functionality of this bean.
System.out.println("==============================================================");
System.out.println("Starting Test Driver for bean " + beanName + "....");
System.out.println("==============================================================");
// Create bean.
inventoryBean myBean = new inventoryBean();
// Create a new record.
int newId = myBean.findMaxPrimaryKey();
newId++;
boolean rc = myBean.insert("e", "t", "g", "R",
newId);
if(rc)
System.out.println("SUCCESS: Inserted new record #= " + newId + ".");
else
System.out.println("ERROR! Can't insert record #= " + newId + ".");
System.out.println("====================================================");
System.out.println("VALIDATION FAILED: Test driver generated an error.");
System.out.println("====================================================");
return;
// Retrieve a record
rc = myBean.findByPrimaryKey(newId);
if(rc)
System.out.println("SUCCESS: Record #" + newId + " found.");
else
System.out.println("====================================================");
System.out.println("VALIDATION FAILED: Test driver generated an error.");
System.out.println("====================================================");
System.out.println("ERROR! Record #" + newId + " NOT found.");
// Simulate using set??? accessor methods with test data.
// (Note: We don't change the primary key.)
int testItemid = newId;
System.out.println("Testing set???() accessor methods....");
System.out.println("Setting Record #" + newId + " to:");
System.out.println(" inventoryBean.setItem(testItem); // = R");
myBean.setItem(testItem);
System.out.println(" inventoryBean.setPlatform(testPlatform); // = Y");
myBean.setPlatform(testPlatform);
System.out.println(" inventoryBean.setSerial(testSerial); // = E");
myBean.setSerial(testSerial);
System.out.println(" inventoryBean.setDescription(testDescription); // = k");
myBean.setDescription(testDescription);
System.out.println(" inventoryBean.setItemid(testItemid); // = " + newId);
myBean.setItemid(testItemid);
// Call update.
rc = myBean.update();
if(rc)
System.out.println("SUCCESS: Record #" + newId + " updated.");
else
System.out.println("ERROR! Record #" + newId + " NOT updated.");
System.out.println("====================================================");
System.out.println("VALIDATION FAILED: Test driver generated an error.");
System.out.println("====================================================");
return;
// Requery and validate each field.
rc = myBean.findByPrimaryKey(newId);
if(rc)
System.out.println("SUCCESS: Updated Record #" + newId + " found.");
else
System.out.println("====================================================");
System.out.println("VALIDATION FAILED: Test driver generated an error.");
System.out.println("====================================================");
System.out.println("ERROR! Record #" + newId + " NOT found");
// Simulate using get??? accessor methods.
// Validate updated values against test values.
System.out.println("Validating Record #" + newId + ":");
String testData;
String actualItem = myBean.getItem();
testData = "R";
if(testData.equals(actualItem))
System.out.println(" OK: inventoryBean.getItem() = actualItem");
else
System.out.println(" ERROR! inventoryBean.getItem() returned [" + actualItem + "] instead of [R]");
isDataValidationError = true;
String actualPlatform = myBean.getPlatform();
testData = "Y";
if(testData.equals(actualPlatform))
System.out.println(" OK: inventoryBean.getPlatform() = actualPlatform");
else
System.out.println(" ERROR! inventoryBean.getPlatform() returned [" + actualPlatform + "] instead of [Y]");
isDataValidationError = true;
String actualSerial = myBean.getSerial();
testData = "E";
if(testData.equals(actualSerial))
System.out.println(" OK: inventoryBean.getSerial() = actualSerial");
else
System.out.println(" ERROR! inventoryBean.getSerial() returned [" + actualSerial + "] instead of [E]");
isDataValidationError = true;
String actualDescription = myBean.getDescription();
testData = "k";
if(testData.equals(actualDescription))
System.out.println(" OK: inventoryBean.getDescription() = actualDescription");
else
System.out.println(" ERROR! inventoryBean.getDescription() returned [" + actualDescription + "] instead of [k]");
isDataValidationError = true;
int actualItemid = myBean.getItemid();
if(actualItemid == newId)
System.out.println(" OK: inventoryBean.getItemid() = actualItemid");
else
System.out.println(" ERROR! inventoryBean.getItemid() returned [" + actualItemid + "] instead of [" + newId + "]");
isDataValidationError = true;
// Cleanup with delete.
rc = myBean.delete(newId);
if(rc)
System.out.println("SUCCESS: Record #" + newId + " deleted.");
else
System.out.println("ERROR! Record #" + newId + " NOT deleted.");
// Now test out findRecords() for up to 100 records.
Hashtable data = myBean.findRecords("itemid > 0", "itemid");
String s = (String)data.get("STATUS");
if(s != null && s.equals("OK"))
s = (String)data.get("ROWCOUNT");
int rowCount = Integer.parseInt(s);
if(rowCount > 100) // Just output first 100 records.
rowCount = 100;
System.out.println("SUCCESS: Returning " + rowCount + " records (100 max.) using findRecords():");
for(int i = 0; i < rowCount; i++)
System.out.println(" Row #" + i + "=" +
data.get("item" + i) + ", " +
data.get("platform" + i) + ", " +
data.get("serial" + i) + ", " +
data.get("description" + i) + ", " +
data.get("itemid" + i));
else
System.out.println("ERROR! No rows returned using findRecords()!");
System.out.println("====================================================");
System.out.println("VALIDATION FAILED: Test driver generated an error.");
System.out.println("====================================================");
return;
if(isDataValidationError == false)
// Print final success message.
System.out.println("================================================================================");
System.out.println("VALIDATION SUCCESS! Bean " + beanName + " passed all automated tests.");
System.out.println("================================================================================");
else
System.out.println("====================================================================================");
System.out.println("ERROR! Tests completed but bean " + beanName + " had a data validation error.");
System.out.println("====================================================================================");Couple of pointers.
1 - use [ code ] tags to post code
2 - that is WAY too much code for more than a cursory glance. You're lucky the problem was easy to spot.
Your problem lies in your edit JSP form:
<td>Product Name:</td>
<td><input name="description" type="text" value="<jsp:getProperty name="inventoryBean" property="item" />"></td>Note that the name of the input field is different from the jsp property you are populating it with.
In fact, all of your input fields have a name of "description"
I would recommend on your inventory_admin.jsp page that you put the following debugging code to make sure that the parameter values come through and are set correctly.
out.println("name = param: " + request.getParameter("name") + "bean = " + inventoryBean.getName() + "<BR>");
out.println("description = param:" + request.getParameter("description") + "bean = " + inventoryBean.getDescription() + "<BR>");
... -
How can i access a mysql table without putting the data in a datagrid
I developed my air app with a datagrid which uses a php service to display all data from a table of strings in MySql.
I now do not need the datagrid, how can i get the data from my database without putting it into a dataGrid? Do i need an array? how do i do this? anyone got any example code?Balakrishnan V wrote:
var resultArrayCollection:ArrayCollection=new ArrayCollection()
protected function resultHandler(event:ResultEvent)
result=event.result as ArrayCollection
You can use the result array collection now inside your program for any further changes / manipulations.
Hope this helps; If you have further doubts, do ask...
Balakrishnan V
Hi, yeah this helps,
however, how would i generate a result handler for a service that has not been called yet? Sorry my knowledge of services is very limited.
This is a php service, get_all service that returns all the rows from a mysql table.
I can see the service box with the service i want to use:
but how do i pass that to a result handler? -
MySQL will not display table data
I correctly set the datasource connect to MySQL I can update the table from within creator but I cant get Creator to view the data.
Duplicate of http://swforum.sun.com/jive/thread.jspa?threadID=51486&tstart=0
-
Hi,
I got a problem which i stuck in.Here how it goes:
i entered the data in MySql database as shown below
movieid movietitle cinema
1 signs apple
2 signs pear
3 signs orange
4 ET pear
5 ET orange
I got a main page in which user can select his choice of movie (signs,ET) from radio buttons and his choice of cinema from drop boxes.
Now here's the problem, when user choose his movie title and cinema, how do i check whether his choice of movie is availiable in the cinema. Coz some movies in not avail. in particular cinema (ex. ET not avail in apple).I need to display the output on next page.
As a newbie in jsp, i am not familiar on how to start the coding. If anyone knws, pls tell me how to go about doing.If possible, can show me codes on how to compare string with data in database.
Thanx for your time in looking in this prob.I greatly appreciate it ^.^
-miNYou can make the following query on the result page:
"select * from the_table where movietitle = ? and cinema = ?"
then you set movietitle and cinema to those which the user selected. If the resultset contains more than 0 rows, that means the movie is available.
Below is the sample code, it assumes you have a connection to the database:
PreparedStatement stat = myConnection.prepareStatement("select * from the_table where movietitle = ? and cinema = ?");
stat.setString(1, usersMovieTitleSelection);
stat.setString(2, usersCinemaSelection);
ResultSet res = stat.executeQuery();
if (res.next()) {
out.print("The movie is available");
} else {
out.print("The movie is not available");
}Now just add that to your JSP page. Enjoy ! =) -
MYSQL 55 to Oracle 11gr1 replication(oneway) - can not replicate
I have setup golden gate replication between mysql 55 and oracle 11gr1. While trying to setup the initial load, I do'nt see any data push to oracle from mysql.
What could be wrong in my setup.? has anyone tried this kind of setup? i see the the report for replicat and it says data is not replicated. while extract shows that 4 rows from table are taken for insert.Hi Stev
I am trying to do the initial load process
On source (MYSQL 55)
database (ggtest and table test)
table test has
TEST(COL1 INT)
manager is running on default port 7809
manager parameter file is defined with (PORT 7809)
There is initial load extract (EINI01) -->
ADD EXTRACT EINI01
param file
EXTRACT EINI01
SOURCEDB [email protected], USERID ggsdev, PASSWORD ggsdev
RMTHOST 192.168.75.116, MGRPORT 7809
RMPTTASK REPLICAT, GROUP RINI01
TABLE ggtest.TEST
On target oracle 11gr1 (11.1.0.6)
Database in archive log mode, with minimum supplemental logging.
replicat process
ADD REPLICAT RINI01
Parameter file for replicat
REPLICAT RINI01
USERID ggs_owner, PASSWORD ggs_owner ( added in target database)
ASSUMTARGETDEFS
SETENV (NLS_LANG="AMERICAN_AMERICA.WE8MSWIN1252")
MAP ggtest.TEST , TARGET GGTEST.TEST;
-- to start the initial load ( mysql side has 4 rows, oracle has no row )
on source, i ran the command
ggsci> start extract eini01
I can see on report, extract has picked 4 rows for insert, but on replicat side no replication done. No error reported in gserr.log and there was a communication between source side of extract with traget side manager and sunsequently repliacat on target was started by manager and stopped normally. but no rows replicated.
Between oracle-to-oracle there is no problem. But my actual project is to setup from mysql to oracle (one way replication).
let me know if you need any other info.
Thanks
rafey -
Can't display *proper* Chinese char in v3.0.04 connecting to MySQL
Hello to all guru,
I am having some trouble on displaying Chinese characters on SQLDeveloper connecting MySQL database...
Database: MySQL 5.5.17, for Win32 (x86)
SQLDeveloper: 3.0.04
JDBC: Connector/J 5.1.18 from MySQL
Connection has no problem, retrieving data also great.
Using mysql.exe at Windows Command Prompt, it could display the proper Chinese characters perfectly...
mysql> SHOW VARIABLES LIKE 'character_set_system';
-----------------------------+
| Variable_name | Value |
-----------------------------+
| character_set_system | utf8 |
-----------------------------+
1 row in set (0.09 sec)
mysql> select display_name, display_name_chi
-> from contact
-> where display_name = 'David Chan';
--------------------------------+
| display_name | display_name_chi |
--------------------------------+
| David Chan | 陳大衛 |
--------------------------------+
1 row in set (0.00 sec)
Run the same select query on SQLDeveloper, it shows...
display_name display_name_chi
David Chan ³¯¤j½Ã
On SQLDeveloper, Tools > Preferences > Database > NLS, there seems to have some NLS settings to play with, and default settings are:
Language: AMERICAN
Territory: AMERICA
Tried changing to the followings...
Language: TRADITIONAL CHINESE
Territory: TAIWAN
Still displaying the monster characters... I haven't tested to see if SQLDeveloper would behave the same while connecting to Oracle Database, and I am thinking maybe just the Java GUI's issue?!
Can anyone give me some idea?Hi,
Here is a post that provides a solution for a similar Chinese language situation related to the Oracle JDBC driver:
Re: Can't select using special characters (symbols)
Perhaps you will be able to find something equivalent for the MySQL driver.
Regards,
Gary
SQL Developer Team -
I prepared a GUI user connection application in NebBeans 5.5 accessing mySql database in the company server. The application run very well in desktop.
However, when I post it to the company server web, it gets nothing from the database.
Can any one give advice???
Thank you in advance.
The following is my application
import java.util.Vector;
import java.awt.event.*;
import java.awt.*;
import java.awt.event.*;
public class UserConnection extends javax.swing.JFrame {
//constants for database
private final String userName = "labmanage";
private final String password = "labmanage";
private final String server = "jdbc:mysql://svr.corp.com/labmanage";
private final String driver = "com.mysql.jdbc.Driver";
private JDBCAdapter data = new JDBCAdapter(server, driver, userName, password);
//variables
private String user, pwd;
private Vector<Vector<String>> userTable = new Vector<Vector<String>>();
private Vector<String>colUserNames = new Vector<String>();
* Creates new form UserConnection
public UserConnection() {
initComponents();
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">
private void initComponents() {
userLabel = new javax.swing.JLabel();
pwdLabel = new javax.swing.JLabel();
userTextField = new javax.swing.JTextField();
passwordField = new javax.swing.JPasswordField();
submitButton = new javax.swing.JButton();
statusLabel = new javax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane();
statusTextArea = new javax.swing.JTextArea();
changePwdButton = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("User's Connection");
setBackground(new java.awt.Color(153, 204, 255));
setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
setFont(new java.awt.Font("aakar", 1, 12));
userLabel.setText("User Name:");
pwdLabel.setText("Password:");
submitButton.setText("Submit");
submitButton.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
submitButtonMouseClicked(evt);
submitButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
submitButtonActionPerformed(evt);
submitButton.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
submitButtonKeyTyped(evt);
statusLabel.setText("Status:");
statusTextArea.setColumns(20);
statusTextArea.setEditable(false);
statusTextArea.setLineWrap(true);
statusTextArea.setRows(3);
statusTextArea.setText("Initial assigned password is \"dime\".");
statusTextArea.setWrapStyleWord(true);
jScrollPane1.setViewportView(statusTextArea);
changePwdButton.setText("Change password");
changePwdButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
changePwdButtonActionPerformed(evt);
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.addContainerGap()
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(userLabel)
.add(pwdLabel)
.add(statusLabel))
.add(35, 35, 35)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(submitButton)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(changePwdButton))
.add(passwordField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 230, Short.MAX_VALUE)
.add(userTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 230, Short.MAX_VALUE)
.add(org.jdesktop.layout.GroupLayout.TRAILING, jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 230, Short.MAX_VALUE))
.addContainerGap())
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.addContainerGap()
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(userLabel)
.add(userTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(pwdLabel)
.add(passwordField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(statusLabel)
.add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.add(15, 15, 15)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(submitButton)
.add(changePwdButton))
.addContainerGap(27, Short.MAX_VALUE))
pack();
}// </editor-fold>
private void submitButtonKeyTyped(java.awt.event.KeyEvent evt) {
if(evt.getKeyCode() == KeyEvent.VK_ENTER) {
submitButton.doClick();
submitButton.requestFocus();
changePwdButton.requestFocus();
private void changePwdButtonActionPerformed(java.awt.event.ActionEvent evt) {
String command = evt.getActionCommand();
if(command.equals("Change password")) {
passwordField.setText("");
//Get connection to the changing password panel
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new ChangePassword().setVisible(true);
private void submitButtonActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String command = evt.getActionCommand();
if(command.equals("Submit")) {
user = getUser();
pwd = getPwd();
data = new JDBCAdapter(server, driver, userName, password);
data.executeQuery("SELECT * FROM USERTABLE");
colUserNames = data.getColumnNames();
userTable = data.getDataTable();
if(colUserNames.elementAt(0).equals("")) {
statusTextArea.setText("Can not connect to database");
boolean checkUser = false;
int i = 0;
while(!checkUser && i<userTable.size()) {
if(user.equalsIgnoreCase((String) userTable.elementAt(i).elementAt(0))) {
//Find the user in database
checkUser = true;
//Check user's password
if(pwd.equals((String)userTable.elementAt(i).elementAt(1))) {
//Check for initial default password. The user is requested
//to change his password
if(pwd.equals((String) "dime")) {
statusTextArea.setText("You are requested to change your " +
"initial assigned password. Click 'Change password' please.");
else {
//Set UserConnection Panel to invisible
setVisible(false);
dispose();
//Get connection to the table
if(userTable.elementAt(i).elementAt(2).equals("0")) {
//Get connection to non-editable table
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
PVRackReportNonEdit rackReport = new PVRackReportNonEdit();
rackReport.createAndShowDialog();
else {
if(userTable.elementAt(i).elementAt(2).equals("1")) {
//Get connection to editable table
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
PVRackReport rackReport = new PVRackReport(user);
rackReport.createAndShowDialog();
//PVRackReport rackReport = new PVRackReport();
else statusTextArea.setText("You do not get approval for viewing data. " +
"Please contact the administrator for details.");
else {
passwordField.setText("");
statusTextArea.setText("Please enter corrected password or" +
"the administrator for details.");
i++;
if(!checkUser) {
passwordField.setText("");
statusTextArea.setText("Not find such user's name." +
"contact the admistrator for details.");
private void submitButtonMouseClicked(java.awt.event.MouseEvent evt) {
// TODO add your handling code here:
* @param args the command line arguments
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new UserConnection().setVisible(true);
public String getUser() {
return userTextField.getText();
public String getPwd() {
return passwordField.getText();
// Variables declaration - do not modify
private javax.swing.JButton changePwdButton;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JPasswordField passwordField;
private javax.swing.JLabel pwdLabel;
private javax.swing.JLabel statusLabel;
private javax.swing.JTextArea statusTextArea;
private javax.swing.JButton submitButton;
private javax.swing.JLabel userLabel;
private javax.swing.JTextField userTextField;
// End of variables declaration
Here is my JDBCAdapter
package rackdemo2;
* This is an adaptor which transforms the JDBC interface
* to the PVRackTableDialogue
import java.util.Vector;
import java.sql.*;
import javax.swing.table.AbstractTableModel;
import javax.swing.event.TableModelEvent;
public class JDBCAdapter {
Connection connection;
Statement statement;
ResultSet resultSet;
Vector<String> columnNames = new Vector<String>();
Vector<Vector<String>> rows = new Vector<Vector<String>>();
ResultSetMetaData metaData;
public JDBCAdapter(String url, String driverName,
String user, String passwd) {
try {
Class.forName(driverName);
connection = DriverManager.getConnection(url, user, passwd);
statement = connection.createStatement();
catch (ClassNotFoundException ex) {
System.err.println("Cannot find the database driver classes.");
System.err.println(ex);
catch (SQLException ex) {
System.err.println("Cannot connect to this database.");
System.err.println(ex);
public void executeQuery(String query) {
if (connection == null || statement == null) {
System.err.println("There is no database to execute the query.");
return;
try {
resultSet = statement.executeQuery(query);
metaData = resultSet.getMetaData();
int numberOfColumns = metaData.getColumnCount();
// Get the column names and cache them.
// Then we can close the connection.
for(int column = 0; column < numberOfColumns; column++) {
columnNames.addElement(metaData.getColumnLabel(column+1));
// Get all rows.
while (resultSet.next()) {
Vector<String> newRow = new Vector<String>();
for (int i = 1; i <= columnNames.size(); i++) {
String tempString = resultSet.getString(i);
if(!tempString.equals("null")) {
newRow.addElement(tempString);
else {
newRow.addElement("");
rows.addElement(newRow);
//Modify dataTable to add empty row to separate chassis
if(numberOfColumns>1) {
int nRow = rows.size();
Vector<String> row = new Vector<String>();
for(int i=0; i<numberOfColumns; i++){
row.add("");
if(nRow>0 || numberOfColumns>0) {
//Adding blank row to separate chassis
int i = 0;
while(i<nRow) {
if(!rows.elementAt(i).elementAt(0).equals("")) {
if(i>0) {
rows.add(i, row);
i++;
nRow = rows.size();
i++;
close();
catch (SQLException ex) {
System.err.println(ex);
public void close() throws SQLException {
resultSet.close();
statement.close();
connection.close();
// MetaData
public Vector<String> getColumnNames() {
return columnNames;
public Vector<Vector<String>> getDataTable() {
return rows;
public int getColumnCount() {
return columnNames.size();
// Data methods
public int getRowCount() {
return rows.size();
}Thank you for your answer.
I'm very new to mySql as server. When I was assigned
to write the application, the administrator has set
up mySql database in the company web server for my
application. My program runs very when using my
workplace desktop with java web start or with java
web start in netbeans (all paths should be link to my
desktop hard disk, i.e. users/application/). I can
not run the application at home because I can not
access to the company intranet server (for security
purpose). The problem happens when I post the
application in the company web page (I have to modify
all paths in jnlp file to the company web address).
The program then runs without exception except it
seems that it gets no data from the database (for
example, when I type my username, it returns that
"There is no such user name. contact.." as what I
code in the application for not correcting user name)
It happens for not only using my company desktop but
also for others.
Please help me.
Thank you in advance.And all this could have been answered yesterday, in your other thread, when I asked you "Is the DB configured to allow that user to connect to the DB from where that user is attempting to connect from?"
Seeing as how you get that error, the obvious answer was, "No." At which point we could have continued.
Configure the needed users into the DB, without forgetting to allow them access from the machines from which they are going to access from.
Although, I agree with Rene, that you should set up a server of some sort, located on the same machine as the DB, for communicating with the DB.
Maybe you are looking for
-
How to display the data in a multichannel task
The task is composed of reading data from 12 virtual channels, how can I display the real time data in these 12 channels separately after the DAMx read. I tried to use the Select Signals function in the Express. but that means i have to use 12 of the
-
I can't print from Firefox 7 with my HP Laserjet CM 1312
It work well with the previous versionbut as soon as I installed teh English version I can't print. I have installed the Swedish version of Firefox 7 but it doesn't help.
-
I have had problems with my macbook for some time now. I go to update my software and it will search like it would normally. But it then says that i have the most up to date software, when i havnt updated my macbook in at least a year. What do i do b
-
Automatic Link of Documents in purchase requisition and purchase order
Dear guru. I have created a document in CV01N and I have linked it in document data view of a material master(MM02). For every purchase requisition and purchase order position created for this material I need that the system execute an automatic link
-
Tried to open new POP account - disaster
Hi there, I wanted to change over my mail address from one yahoo account to another. When I tried to do this ie: added another account, I typed in exactly the same incoming mail server as the original yahoo address. It tried to check connection to PO